Bug #71316 [Com]: libpng warning from imagecreatefromstring

From: Date: Fri, 13 Jul 2018 08:31:01 +0000
Subject: Bug #71316 [Com]: libpng warning from imagecreatefromstring
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216296@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71316&edit=1

 ID:                 71316
 Comment by:         divinity76+spam at gmail dot com
 Reported by:        humbads at alum dot mit dot edu
 Summary:            libpng warning from imagecreatefromstring
 Status:             Open
 Type:               Bug
 Package:            GD related
 Operating System:   FreeBSD 10.2
 PHP Version:        5.6.17
 Block user comment: N
 Private report:     N

 New Comment:

can reproduce on php 7.1.17 @ ubuntu 17.10  (aka i inconveniently encountered this bug)


Previous Comments:
------------------------------------------------------------------------
[2016-09-05 09:47:14] cmb@php.net

This appears to be a general libgd issue, so I've reported
<https://github.com/libgd/libgd/issues/295>
upstream.

------------------------------------------------------------------------
[2016-07-17 21:57:38] michael dot hartmann at refx dot com

PHP 7.0.8 x64 on Windows. Same problem. Please fix.

------------------------------------------------------------------------
[2016-01-10 01:48:05] 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-01-08 22:27:13] 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-08 22:07:27] 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)


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



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


Thread (16 messages)

« previous php.bugs (#216296) next »