You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the "Caution" in the document: The return value succeeds even if the arguments are invalid.
But PHP 8 is different.
$result = getimagesize('');
var_dump($result);
php 7.4
Warning: getimagesize(): Filename cannot be empty in /home/user/scripts/code.php on line 4
bool(false)
PHP 8.0 or higher
Fatal error: Uncaught ValueError: Path cannot be empty in /home/user/scripts/code.php:4
Stack trace:
#0 /home/user/scripts/code.php(4): getimagesize('') #1 {main}
thrown in /home/user/scripts/code.php on line 4
and some GD extension's function is also
The text was updated successfully, but these errors were encountered:
As such it would need to be documented for other respective functions (such as fopen() and likely many others) as well. I'm not sure that it is a good idea to document this for each affected function.
According to the "Caution" in the document: The return value succeeds even if the arguments are invalid.
That's not what the English documentation states (maybe you're reading a translation). That remark is about invalid image files; getimagesize() doesn't validate the whole image file, but rather reads the first bytes to see whether it might be a supported image type, and then only reads as much information from the file as necessary to fill in the information which is returned by getimagesize(). So you should not use this function to verify that an arbitrary file contains a valid image.
https://www.php.net/getimagesize
According to the "Caution" in the document: The return value succeeds even if the arguments are invalid.
But PHP 8 is different.
php 7.4
Warning: getimagesize(): Filename cannot be empty in /home/user/scripts/code.php on line 4
bool(false)
PHP 8.0 or higher
Fatal error: Uncaught ValueError: Path cannot be empty in /home/user/scripts/code.php:4
Stack trace:
#0 /home/user/scripts/code.php(4): getimagesize('')
#1 {main}
thrown in /home/user/scripts/code.php on line 4
and some GD extension's function is also
The text was updated successfully, but these errors were encountered: