php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #20822 getimagesize() returning null instead of false
Submitted: 2002-12-04 20:47 UTC Modified: 2002-12-05 07:01 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: tit dot petric at telemach dot net Assigned: john (profile)
Status: Closed Package: Documentation problem
PHP Version: 4.2.3 OS: linux
Private report: No CVE-ID: None
 [2002-12-04 20:47 UTC] tit dot petric at telemach dot net
cutting out from the php manual:

If accessing the filename image is impossible, or if it isn't a valid picture, getimagesize() will return FALSE and generate a warning.

... when getimagesize() in fact returns NULL (atleast in 4.2.3 (debian unstable tree))

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-04 20:54 UTC] tit dot petric at telemach dot net
maybe its also worth mentioning that getimagesize() spews out an error if the filesize() of the file is 0 bytes :/ - this isnt so nice :/
 [2002-12-05 01:42 UTC] iliaa@php.net
getimagesize() returns NULL only in one case and that being if invalid parameters are passed to the functions. For example calling getimagesize() without any parameters. Invalid files and so on, result in the documentated FALSE return value.
 [2002-12-05 03:34 UTC] tit dot petric at telemach dot net
unless getimagesize() started to take more than one parameter, i have everything necessery

i pretty much get an error if the filesize of the file is 0 bytes, and get NULL if the file is not an image (maybe i dont get it always - but the plaintext files i tried always returned NULL for me

the manual should specify the result as NULL or FALSE, but i dont think your comment here is correct - atleast not to my testing. perhaps if you replace null with false, and vice versa, because i do get null with valid parameters.

cheers
 [2002-12-05 03:37 UTC] tit dot petric at telemach dot net
didnt read the other email's :) anyway

returning false on everything and removing that E_ERROR does the trick :)

thanks php team!
 [2002-12-05 07:01 UTC] helly@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

In 4.2.3 there was just another possibility to return NULL. Now all current versions (4.2.3-cvs, 4.3.0-cvs, cvs) return FALSE in *every* case. If someone does not want the error messages from file in/output start another bugreport please. But i suggest to have them in because they show the reason why GetImagesize() fails. At least until we output specific messages inside image.c itself.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 20:01:29 2024 UTC