From: bytewise at gmx dot net Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: imagepng: second parameter must not be '' or NULL
Description: ------------ The documentation of imagepng (in English and German) states that the second parameter may be null or the empty string: " bool imagepng ( resource image [, string filename] ) The filename argument is optional, and if left off or filled with a NULL value, the raw image stream will be output directly. " This is not the case, at least in php 5.1.6 this function does not work anymore if given an empty string or null as second parameter. It will merely generate a warning ("Unable to open '' for writing"), and output some trash, not a real png image. This problem is NOT related to sending a bad header. The same code worked fine for me in php 5.0.4; after an upgrade to 5.1.6 it stopped working. I removed the second (null) parameter to imagepng, and it worked again. Only it took a couple of hours to find out :) There at least 2 bug reports that are related to this, both of which have been closed (nothing having been done about them): http://bugs.php.net/35061 http://bugs.php.net/36464 -- Edit bug report at http://bugs.php.net/?id=38794&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38794&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38794&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38794&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38794&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38794&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38794&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38794&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38794&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38794&r=support Expected behavior: http://bugs.php.net/fix.php?id=38794&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38794&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38794&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38794&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38794&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38794&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38794&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38794&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38794&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38794&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38794&r=mysqlcfg