ID: 41321 Updated by: [EMAIL PROTECTED] Reported By: marduc at start dot no -Status: Closed +Status: Open -Bug Type: GetImageSize related +Bug Type: Documentation problem Operating System: OS X PHP Version: 5.2.2 New Comment:
Re-open as documentation problem (see Ilias comment) Previous Comments: ------------------------------------------------------------------------ [2007-05-08 18:38:36] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Read errors have been downgraded to E_NOTICE. ------------------------------------------------------------------------ [2007-05-08 17:53:07] [EMAIL PROTECTED] "I do prefer that it doesn't give off any warnings tho as the function is a nice way to check for invalid images." I agree, such functions should be quiet unless something critical for php happened, invalid images do not fit in this category. ------------------------------------------------------------------------ [2007-05-08 16:24:36] with at thesublevels dot com The same thing happens to me on a linux box with 5.2.2. The problem is not that an error appears, but that it only appears when you use the function on a very small file. According to the docs the error should appear on all invalid files. I do prefer that it doesn't give off any warnings tho as the function is a nice way to check for invalid images. I just use an extra check for the length of the file to avoid the error altogether since no image files get as small as just a couple of bytes. ------------------------------------------------------------------------ [2007-05-08 15:02:09] marduc at start dot no 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) ------------------------------------------------------------------------ [2007-05-07 21:46:45] marduc at start dot no Am I missing something? The docs says "If accessing the filename image is impossible, or if it isn't a valid picture, getimagesize() will generate an error of level E_WARNING". Using getimagesize on a textfile containing 12 or more characters or any other file not being a valid picture, say a pdf-document, does not produce a warning? The only time I get a warning is using a textfile containing less than 12 characters. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41321 -- Edit this bug report at http://bugs.php.net/?id=41321&edit=1