From:             marduc at start dot no
Operating system: OS X
PHP version:      5.2.2
PHP Bug Type:     GetImageSize related
Bug description:  getimagesize() gives warning on files containing less than 
12characters of dat

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 bug report at http://bugs.php.net/?id=41321&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41321&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41321&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41321&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41321&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41321&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41321&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41321&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41321&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41321&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41321&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41321&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41321&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41321&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41321&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41321&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41321&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41321&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41321&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41321&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41321&r=mysqlcfg

Reply via email to