Bug #72278 [Fbk->NoF]: getimagesize returning FALSE on valid jpg
Edit report at https://bugs.php.net/bug.php?id=72278&edit=1
ID: 72278
Updated by: php-bugs@lists.php.net
Reported by: bfarber at invisiopower dot com
Summary: getimagesize returning FALSE on valid jpg
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: GetImageSize related
Operating System: AWS / Windows
PHP Version: 5.6.22
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2016-05-28 04:01:19] pajoye@php.net
Can you upload the image somewhere pls or send it to me pls?
------------------------------------------------------------------------
[2016-05-27 22:28:41] requinix@php.net
The image has some extra bytes in it that are messing up the detection, but there's not much
technical information about JPEGs out there and the standard itself is paywalled so I can't
verify if it's technically legal or just a vendor quirk. If I open the image in GIMP it warns
me about the extra bytes and recovers.
Those extra bytes are part of the 0xE1 Exif frame starting at offset 0x15. It says length
0x7D08/32008 but there are then 260 bytes of 0x00 unaccounted for until the next 0xFFED. Image
suggests it's from Photoshop CS2?
Could image.c's php_next_marker gracefully handle this situation? Automatically consume any
"leading" nulls it finds?
------------------------------------------------------------------------
[2016-05-27 20:45:31] bfarber at invisiopower dot com
Description:
------------
The documentation for getimagesize() indicates the function returns FALSE on failure, so the
function is behaving as described, however I cannot find any reason getimagesize() should be failing
to parse this particular image. A client has supplied a valid jpeg image and I can read the EXIF
data from it with a standalone parser, but getimagesize() fails to parse it.
We have tested on multiple versions and have seen the same behavior on all environments we've
tested on. I have not tested PHP7 yet. I have tested on Amazon's hosting environment, as well
as my local WAMP stack.
http://bfarber.com/getimagesize_test/test.php
Image can be found here: http://bfarber.com/getimagesize_test/image.jpg
Test script:
---------------
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
print "PHP version is " . PHP_VERSION . "<br>";
var_dump( getimagesize('image.jpg') );
exit;
Expected result:
----------------
I should see an array output with the image width, height, etc.
Actual result:
--------------
boolean false is returned
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72278&edit=1
Thread (9 messages)