ID: 29482 Updated by: [EMAIL PROTECTED] Reported By: troublegum at woltlab dot de -Status: Open +Status: Bogus Bug Type: GD related Operating System: Windows XP Professional PHP Version: 5.0.0 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Use the getimagesize() function to validate the image first if you are unsure about the file's contents. Previous Comments: ------------------------------------------------------------------------ [2004-08-01 15:55:51] troublegum at woltlab dot de Description: ------------ imagecreatefrompng() should not throw a fatal error when opening broken image files. Instead, a warning would be much more useful. The following code is useless as the scripts dies without any output. If I remove the @, it throws the following message: --- Fatal error: imagecreatefrompng() [function.imagecreatefrompng]: gd-png: fatal libpng error: Invalid chunk length. in F:\htdocs\bug\read.php on line 3 --- imagecreatefrompng throws a warning when opening files that are no png files ('broken.png' is not a valid PNG file) but not when the image file is a png image, bug is broken for whatever reason. --- OS: Windows XP Professional Apache: 2.0.49 PHP: 5.0.0 as apache module GD: bundled (2.0.23 compatible) PNG Support: enabled Reproduce code: --------------- <?php $filename = 'broken.png'; $imageResource = @imagecreatefrompng($filename); if (!$imageResource) { die('could not read ' . $filename . ' image'); } else { echo 'image ' . $filename . ' successfully read'; } ?> Expected result: ---------------- could not read broken.png image Actual result: -------------- Fatal error: imagecreatefrompng() [function.imagecreatefrompng]: gd-png: fatal libpng error: Invalid chunk length. in F:\htdocs\bug\read.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29482&edit=1
