ID:               45799
 Updated by:       [EMAIL PROTECTED]
 Reported By:      amelek32 at gmail dot com
-Status:           Bogus
+Status:           Assigned
 Bug Type:         GD related
 Operating System: Windows XP Pro x64
 PHP Version:      5.2.6
-Assigned To:      
+Assigned To:      pajoye
 New Comment:

> shouldn't it return warning without putting part of header to
output?

Hm, good point. I may add a check before calling the png function and
avoid to much troubles later. I will do it for 5.3+


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

[2008-08-12 13:45:49] amelek32 at gmail dot com

shouldn't it return warning without putting part of header to output?

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

[2008-08-12 13:37:02] [EMAIL PROTECTED]

That's libpng behaviors. A PNG palette image must have colors to be
saved.

By the way, warnings are not crashes.

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

[2008-08-12 13:29:36] amelek32 at gmail dot com

Description:
------------
imagepng *crashes* when no color was alocated.

I see no point in rendering blank images, but this functions behavior
is buggy. 

All other functions (imagejpeg, imagegif) AND imagepng on true scale
images return black image. This is most likely expected result.

Instead, this function flushes some part of header and then crashes
with warnings when trying to convert non existing color palette.

GD Version  bundled (2.0.34 compatible)  

Reproduce code:
---------------
<?
$img = imagecreate(500,500);
//header("Content-type: image/png"); // skip this to see the problem,
else browser will ignore corrupted image.
imagepng($img);
imagedestroy($img);
?>

Expected result:
----------------
blank black image (like other image* functions) or E_WARNING without
junk.

Actual result:
--------------
‰PNG  IHDRôôñMÉ
Warning: imagepng() [function.imagepng]: gd-png: fatal libpng error:
Invalid number of colors in palette in C:\usr\apache\httpd\html\draw.php
on line 21

Warning: imagepng() [function.imagepng]: gd-png error: setjmp returns
error condition in C:\usr\apache\httpd\html\draw.php on line 21


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


-- 
Edit this bug report at http://bugs.php.net/?id=45799&edit=1

Reply via email to