#41321 [Bgs->Opn]: getimagesize() gives warning on files containing less than 12characters of dat
| From: | marduc at start dot no | Date: | Mon, 07 May 2007 21:24:39 +0000 |
| Subject: | #41321 [Bgs->Opn]: getimagesize() gives warning on files containing less than 12characters of dat | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112373@lists.php.net to get a copy of this message | ||
ID: 41321
User updated by: marduc at start dot no
Reported By: marduc at start dot no
-Status: Bogus
+Status: Open
Bug Type: GetImageSize related
Operating System: OS X
PHP Version: 5.2.1
New Comment:
Same thing happens using the latest CVS Snapshot. "Read error!" on
getimagesize() on a textfile containing less than 12 characters. No
warning on getimagesize() on the same file containing 13 characters.
Previous Comments:
------------------------------------------------------------------------
[2007-05-07 21:16:44] tony2001@php.net
No bug -> bogus.
------------------------------------------------------------------------
[2007-05-07 21:04:43] marduc at start dot no
Correction to prevois post:
Reading the documentation I noticed "If accessing the filename image is
impossible, or if it isn't a valid picture, getimagesize() will generate
an error of level E_WARNING", meaning the expected result should be an
error of level E_WARNING in any case of the file not being an image.
------------------------------------------------------------------------
[2007-05-07 21:03:14] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[2007-05-07 20:56:05] marduc at start dot no
Description:
------------
Checking the mime-types of files using getimagesize() produces a
warning (Warning: getimagesize() [function.getimagesize]: Read error!)
if the file contains less than 12 characters. That is, a file of any
extension containing the sequence abcdefghijk gives a warning. Trying to
read a file containing the sequence abcdefghijkl gives no warning. This
is done on PHP5.2.1.
Also tested this on PHP5.1.6, and it seems less than 11 characters
gives a warning.
Is php trying to read more bytes than available?
Reproduce code:
---------------
<?
/* the directory asdf/ is a directory which apache is the owner of */
exec("touch asdf/asdf");
fwrite(fopen("asdf/asdf", "w"), "abcdefghijk");
$im = getimagesize("asdf/asdf");
?>
Expected result:
----------------
no output, no warning
Actual result:
--------------
Warning: getimagesize() [function.getimagesize]: Read error! in
/Users/torgeir/Sites/test.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41321&edit=1