Edit report at https://bugs.php.net/bug.php?id=70276&edit=1
ID: 70276
Updated by: php-bugs@lists.php.net
Reported by: bugs dot php dot net at spectrumcs dot net
Summary: gd-png: fatal libpng error: bad parameters to zlib
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: GD related
Operating System: FreeBSD 10.0-RELEASE-p17
PHP Version: 5.6.12
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2016-09-04 22:35:40] cmb@php.net
Do you still experience this issue?
> Most interestingly, if I run the same script from the command
> line (su'd to the webserver user!) I do not get the errors (I
> get the raw PNG but that's expected).
Do both SAPIs use the same library versions?
------------------------------------------------------------------------
[2016-08-08 20:32:29] UAEpro at live dot com
this problem happen because you may used a png image with pngcrush to reduce the size, so that why
it's not working ... how to fix it .. i don't know
------------------------------------------------------------------------
[2015-08-15 12:36:05] bugs dot php dot net at spectrumcs dot net
Description:
------------
I'm migrating a Wordpress site from one server another and I've run to to a problem with
some of the images not being displayed. The images are being piped though a PHP script to
dynamically resize them. After some investigation I've noticed that the issue is only effecting
PNG images and found errors relating to gd-png in the webserver logs. As a test I created a simple
php script which just opens a PNG with imagecreatefrompng and every time access the script via a
browser I get the following errors...
PHP Warning: imagecreatefrompng(): gd-png: fatal libpng error: bad parameters to zlib in
.../test.php on line 10
PHP Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in .../test.php on
line 10
PHP Warning: imagecreatefrompng(): 'test.png' is not a valid PNG file in .../test.php on
line 10
I have tried several different png's from several different sources in case the png's
where the problem, but alias it seems to effect all png's regardless of origin.
Most interestingly, if I run the same script from the command line (su'd to the webserver
user!) I do not get the errors (I get the raw PNG but that's expected).
I'm not sure if that makes it a PHP problem of an webserver problem, but I can't think of
any reason why running the script via the webserver should cause such a problem. No permission
issues are in play.
I have two webservers setup very similar, both experience the same problem.
My apologies if this is not the correct place to report such a problem.
Note, I spent quite a few hours on this yesterday evening and was running PHP 5.6.11 but I have this
morning upgraded to 5.6.12 and the problem persists.
# uname -a
FreeBSD indigo 10.0-RELEASE-p17 FreeBSD 10.0-RELEASE-p17 #0: Tue Jan 27 13:45:18 UTC 2015
# httpd -V
Server version: Apache/2.4.16 (FreeBSD)
Server built: Aug 14 2015 23:52:56
Server's Module Magic Number: 20120211:47
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/usr/local"
-D SUEXEC_BIN="/usr/local/bin/suexec"
-D DEFAULT_PIDLOG="/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="/var/run/apache_runtime_status"
-D DEFAULT_ERRORLOG="/var/log/httpd-error.log"
-D AP_TYPES_CONFIG_FILE="etc/apache24/mime.types"
-D SERVER_CONFIG_FILE="etc/apache24/httpd.conf"
# php -i
phpinfo()
PHP Version => 5.6.12
System => FreeBSD indigo 10.0-RELEASE-p17 FreeBSD 10.0-RELEASE-p17 #0: Tue Jan 27 13:45:18 UTC
2015 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
Build Date => Aug 15 2015 12:38:40
Configure Command => './configure' '--with-layout=GNU'
'--localstatedir=/var' '--with-config-file-scan-dir=/usr/local/etc/php'
'--disable-all' '--enable-libxml' '--enable-mysqlnd'
'--with-libxml-dir=/usr/local' '--with-pcre-regex=/usr/local'
'--with-zlib-dir=/usr' '--program-prefix=' '--enable-fpm'
'--with-fpm-user=www' '--with-fpm-group=www' '--with-regex=php'
'--with-zend-vm=CALL' '--prefix=/usr/local' '--mandir=/usr/local/man'
'--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd10.0'
'build_alias=amd64-portbld-freebsd10.0' 'CC=cc' 'CFLAGS=-O2
'-pipe' '-fstack-protector' '-fno-strict-aliasing''
'LDFLAGS= '-fstack-protector'' 'LIBS=-lpthread' 'CPPFLAGS='
'CPP=cpp' 'CXX=c++' 'CXXFLAGS=-O2 '-pipe'
'-fstack-protector' '-fno-strict-aliasing''
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/etc
Loaded Configuration File => /usr/local/etc/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php
Additional .ini files parsed => /usr/local/etc/php/extensions.ini
PHP API => 20131106
PHP Extension => 20131226
Zend Extension => 220131226
Zend Extension Build => API220131226,NTS
PHP Extension Build => API20131226,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => disabled
Registered PHP Streams => compress.bzip2, php, file, glob, data, http, ftp, https, ftps,
compress.zlib, zip, phar
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, sslv2, tls, tlsv1.0,
tlsv1.1, tlsv1.2
Registered Stream Filters => bzip2.*, string.rot13, string.toupper, string.tolower,
string.strip_tags, convert.*, consumed, dechunk, convert.iconv.*, mcrypt.*, mdecrypt.*, zlib.*
...
...
...
gd
GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.6.0
T1Lib Support => enabled
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 8
PNG Support => enabled
libPNG Version => 1.6.17
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
JIS-mapped Japanese Font Support => enabled
...
...
...
zlib
ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
Compiled Version => 1.2.8
Linked Version => 1.2.8
Any advice gratefully received!
Regards
Steve
Test script:
---------------
<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
function LoadPNG($imgname)
{
/* Attempt to open */
$im = imagecreatefrompng($imgname);
/* See if it failed */
if(!$im)
{ // create error image
$im = imagecreatetruecolor(1500, 30); $bgc = imagecolorallocate($im, 255, 255, 255); $tc
= imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 1500, 30, $bgc);
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
return $im;
}
header('Content-Type: image/png');
$img = LoadPNG('test.png');
imagepng($img);
imagedestroy($img);
?>
Expected result:
----------------
I'd expect the script to open the images and display it in the web browser. It works for jpegs
(using imagecreatefromjpeg obviously)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70276&edit=1