|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-05-03 19:22 UTC] Rich dot West at wesmo dot com
Description:
------------
After upgrading from PHP 4.3.3 to 4.3.5, and then again to 4.3.6, I discovered that image generation calls to create PNG files were producing zero length images.
I dug through it further by testing with the CLI version of PHP, and it appears that if a PNG image is being created, the process with segfault.
I was able to compile PHP 4.3.3 on this machine using the configure options below, and, after running the test script through php, it would properly output a PNG file.
Using the same configure options for PHP 4.3.5 and PHP 4.3.6, the operation segfaults (and creates a core file) when creating a PNG file. It works just fine when creating a JPEG file.
I can consistently get things to work for PHP 4.3.3 and I can consistently get it to NOT work for PHP 4.3.5 and PHP 4.3.6...
Oh, and, yes, my GD and libpng10/libpng libraries are linked properly..
From phpinfo():
'./configure' '--host=i686-pc-linux-gnu' '--build=i686-pc-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-pdflib' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-apxs2=/usr/sbin/apxs'
Reproduce code:
---------------
<?php
header("Content-type: image/png");
$string = "Test";
$im = imagecreatefrompng("image.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
Expected result:
----------------
Result should have been a PNG image.
Actual result:
--------------
#0 0x00002009 in ?? ()
#1 0x00f1d850 in png_create_struct_2 () from /usr/lib/libpdf.so.1
#2 0x00997dcd in png_create_info_struct () from /usr/lib/libpng12.so.0
#3 0x080c1b72 in gdImageCreateFromPngCtx ()
#4 0x080c1a61 in gdImageCreateFromPng ()
#5 0x080af917 in zif_imagecreatefromstring ()
#6 0x080afbea in zif_imagecreatefrompng ()
#7 0x0a11aa34 in ?? ()
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 04:00:01 2025 UTC |
I am experiencing the same bug since we upgraded from php 4.3.5 tot 4.3.6, 4.3.7 and the latest snapshot (php4-STABLE-200405270830). I have backtraced the point to where php crashes and that is the imagecreatefrompng function: ... eval(sprintf("\$this->image = imagecreatefrom%s(\$this->image_file);",$this->ext2func[$image_type])); ... (note: i use eval in my class to dynamically open images; however without the evaluation the function still kills my application) However downgrading back to php-4.3.5 does not seem to solve the problem. We are running debian stable with all recent upgrades (libpng etc) with apache (1.3.29) and php and compiled php with the following configure command: './configure' '--with-pgsql' '--with-apxs=/www/bin/apxs' '--with-gd' '--with-png-dir' '--with-freetype-dir' '--with-jpeg-dir' '--with-pear' '--with-zlib-dir' '--enable-track-vars' '--enable-trans-sid' '--disable-posix-threads' '--enable-shared' '--enable-exif' '--enable-memory-limit' I hope this bug will be fixed soon. Grtz, Jeroen