#41321 [Bgs->Opn]: getimagesize() gives warning on files containing less than 12characters of dat

From: Date: Tue, 08 May 2007 15:02:09 +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-112400@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 +PHP Version: 5.2.2 New Comment: 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) Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2007-05-07 21:33:37] derick@php.net Why did you reopen? You get a warning, just like the docs say... ------------------------------------------------------------------------ [2007-05-07 21:24:39] marduc at start dot no 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. ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ 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

« previous php.bugs (#112400) next »