php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71316 libpng warning from imagecreatefromstring
Submitted: 2016-01-08 22:07 UTC Modified: 2016-09-05 09:47 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: humbads at alum dot mit dot edu Assigned: pajoye
Status: Assigned Package: GD related
PHP Version: 5.6.17 OS: FreeBSD 10.2
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-01-08 22:07 UTC] humbads at alum dot mit dot edu
Description:
------------
imagecreatefromstring is writing a warning message to stderr that can not be suppressed by '@' or captured by the error handler.  It should emit a proper PHP warning instead.

I have the following version of libPNG:

php -i | grep -i libpng
libPNG Version => 1.6.19+apng

To run the test script, download the sample PNG image from here:
http://imgbox.com/BzOXLiOr

Note: libPNG 1.5.18 on PHP 5.6.17 for Windows does not have this problem.

Test script:
---------------
php -r '@var_dump(imagecreatefromstring(file_get_contents("1CCHOHSULGF78KW.png")));' 


Expected result:
----------------
resource(6) of type (gd)

Actual result:
--------------
libpng warning: iCCP: known incorrect sRGB profile
resource(6) of type (gd)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-08 22:27 UTC] humbads at alum dot mit dot edu
A workaround is to run the following ImageMagick command on the PNG file before processing:

mogrify -strip 1CCHOHSULGF78KW.png

Source:
http://stackoverflow.com/questions/22745076/libpng-warning-iccp-known-incorrect-srgb-profile
 [2016-01-10 01:48 UTC] pajoye@php.net
-Assigned To: +Assigned To: pajoye
 [2016-01-10 01:48 UTC] pajoye@php.net
Thanks for your report!

Hm. This is a libpng warning.I suppose they move this warning to a simple warning level. 

I will see if we can implement the warning only callback without introducing too much noises:

 png_structp png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn);

only png_error is used now and generates php error.
 [2016-07-17 21:57 UTC] michael dot hartmann at refx dot com
PHP 7.0.8 x64 on Windows. Same problem. Please fix.
 [2016-09-05 09:47 UTC] cmb@php.net
This appears to be a general libgd issue, so I've reported
<https://github.com/libgd/libgd/issues/295> upstream.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC