|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-04 02:06 UTC] iliaa@php.net
[2004-08-04 02:46 UTC] troublegum at woltlab dot de
[2004-08-04 13:49 UTC] troublegum at woltlab dot de
[2016-04-03 17:34 UTC] krakjoe@php.net
-Package: Feature/Change Request
+Package: *General Issues
[2016-04-03 17:37 UTC] krakjoe@php.net
-Status: Open
+Status: Closed
-Package: *General Issues
+Package: GD related
-Assigned To:
+Assigned To: krakjoe
[2016-04-03 17:37 UTC] krakjoe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 17 12:00:01 2025 UTC |
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