ID:          38794
 Comment by:  fletch at pobox dot com
 Reported By: bytewise at gmx dot net
 Status:      Assigned
 Bug Type:    Documentation problem
 PHP Version: Irrelevant
 Assigned To: pajoye
 New Comment:

This is also present, at least in imagepng(), in 5.1.4.

imagepng( $img, NULL ) triggers this error:

Warning: imagepng() [function.imagepng]: Unable to open '' for writing


Previous Comments:
------------------------------------------------------------------------

[2006-09-12 19:14:43] bytewise at gmx dot net

Then I guess the documentation *really* needs an update, because it
looks totally different. There is no mention of the quality and filter
arguments.

Additionally, the empty string is *also* invalid, not only NULL.

------------------------------------------------------------------------

[2006-09-12 18:23:42] [EMAIL PROTECTED]

The function accepts the following arguments set:
imagepng($im, "filename"); save $im as filename

# save $im as filename, using compression and $filter
imagepng($im, "filename", $compression, $filter);

# Output $im, using compression and $filter
imagepng($im, NULL, $compression, $filter);

NULL is invalid if the compression and filter arguments are not used.

------------------------------------------------------------------------

[2006-09-12 16:09:42] bytewise at gmx dot net

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 this bug report at http://bugs.php.net/?id=38794&edit=1

Reply via email to