Bug->Doc #74239 [Ver->Csd]: getimagesize returns incorrect value for corrupt file.
| From: | cmb@php.net | Date: | Fri, 17 Mar 2017 12:12:59 +0000 |
| Subject: | Bug->Doc #74239 [Ver->Csd]: getimagesize returns incorrect value for corrupt file. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14509@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74239&edit=1
ID: 74239
Updated by: cmb@php.net
Reported by: akaamitgupta at gmail dot com
Summary: getimagesize returns incorrect value for corrupt
file.
-Status: Verified
+Status: Closed
-Type: Bug
+Type: Documentation Problem
Package: GetImageSize related
Operating System: Mac OSX
PHP Version: 5.6.30
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2017-03-17 12:12:21] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=342146
Log: Fix #74239: getimagesize returns incorrect value for corrupt file.
We promote the respective notice to a caution, move it up, and explain
that the returned array may contain nonsense.
------------------------------------------------------------------------
[2017-03-17 11:58:59] cmb@php.net
From the manual[1]:
| This function expects filename to be a valid image file. If a
| non-image file is supplied, it may be incorrectly detected as an
| image and the function will return successfully.
This notice should better be moved to a more prominent place, and be
improved. So I'm changing to doc-bug.
[1] <http://php.net/manual/en/function.getimagesize.php#refsect1-function.getimagesize-notes>
------------------------------------------------------------------------
[2017-03-12 10:12:03] akaamitgupta at gmail dot com
Description:
------------
I have wrapped an executable inside an image which has the following content -
GIF89a<?php
echo 'hacked';
?>
and saved it as filename image.gif.
Whene I use getimagesize() PHP function then it returns
array:6 [â¼
0 => 16188
1 => 26736
2 => 1
3 => "width="16188" height="26736""
"channels" => 3
"mime" => "image/gif"
]
although image is not valid but still it has valid width and height.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74239&edit=1