|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-07 20:56 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 20:00:01 2025 UTC |
code ---- file_put_contents("test", "123456789012"); echo "12 chars:\n"; var_dump(getimagesize("test")); file_put_contents("test", "1234567890"); echo "10 chars:\n"; var_dump(getimagesize("test")); output ------ 12 chars: bool(false) 10 chars: Warning: getimagesize(): Read error! in /home/user/test.php on line 8 bool(false)I am using the following code with PHP 5.3.3 -- <?php file_put_contents('abc', '12345678901'); $v = getimagesize('abc'); unlink('abc') ?> -- and I get the notice "getimagesize(): Read error!". Therefore I would say that this is a regression? Do note that with the text '123456789012' I do not get the notice. So it is exactly as the bug opener described it and the bug is not fixed. Please reopen.