Bug #75708 [NEW]: getimagesize with "&$imageinfo" fails on StreamWrappers

From: Date: Wed, 20 Dec 2017 02:54:37 +0000
Subject: Bug #75708 [NEW]: getimagesize with "&$imageinfo" fails on StreamWrappers
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213173@lists.php.net to get a copy of this message
From:             joehoyle at gmail dot com
Operating system: Alpine Linux
PHP version:      7.1.12
Package:          Streams related
Bug Type:         Bug
Bug description:getimagesize with "&$imageinfo" fails on StreamWrappers

Description:
------------
When using getimagesize( $path, $imageinfo ) on specific images in
conjunction with a custom StreamWrapper path, multiple "PHP Warning: 
getimagesize(): corrupt JPEG data: 536 extraneous bytes before marker
in..." errors are shown, and the $imageinfo is empty.

This also happens with a "fake filesystem streamwrapper" as
demonstrated.

Test script:
---------------
https://gist.github.com/joehoyle/b9484e6375ce3a1d4cbefe5e439ef80d

Using image: https://joehoyle-captured.s3.amazonaws.com/test.jpg

Expected result:
----------------
bool(true)
bool(true)
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 183 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 140 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 175 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 854 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 723 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 31 extraneous bytes before marker in /usr/src/app/test.php on line
60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 79 extraneous bytes before marker in /usr/src/app/test.php on line
60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 502 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 48 extraneous bytes before marker in /usr/src/app/test.php on line
60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 116 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 295 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 710 extraneous bytes before marker in /usr/src/app/test.php on
line 60
[20-Dec-2017 02:51:20 UTC] PHP Warning:  getimagesize(): corrupt JPEG
data: 536 extraneous bytes before marker in /usr/src/app/test.php on
line 60
done

Actual result:
--------------
bool(true)
bool(true)
done

-- 
Edit bug report at https://bugs.php.net/bug.php?id=75708&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=75708&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=75708&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=75708&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=75708&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=75708&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=75708&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=75708&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=75708&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=75708&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=75708&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=75708&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=75708&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=75708&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75708&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=75708&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=75708&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=75708&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75708&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=75708&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=75708&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#213173) next »