[PHP-DOC] Re: [PHP-DEV] RE: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false
The return false part is ok but why not showing the warnings from fopen? marcus At 13:16 05.12.2002, John Coggeshall wrote: Here's the patch (again, this makes all getimagesize() failures return false instead of some of them returning NULL, and turns off error reporting if the file fails to open. John --- image.org.c Thu Dec 5 06:06:48 2002 +++ image.c Wed Dec 4 22:54:16 2002 @@ -908,7 +908,7 @@ zval_dtor(*info); if (array_init(*info) == FAILURE) { - return; + RETURN_FALSE; } convert_to_string_ex(arg1); @@ -919,7 +919,7 @@ break; } - stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), rb, REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL); + stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), rb, IGNORE_PATH|ENFORCE_SAFE_MODE, NULL); if (!stream) { RETURN_FALSE; @@ -976,7 +976,8 @@ if (array_init(return_value) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_ERROR, Unable to initialize array); efree(result); - return; +RETURN_FALSE; + } add_index_long(return_value, 0, result-width); add_index_long(return_value, 1, result-height); -Original Message- From: Derick Rethans [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 1:39 AM To: John Coggeshall Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false On Wed, 4 Dec 2002, John Coggeshall wrote: I've changed the getimagesize() function so that it RETURN_FALSE on every error, and disables the error reporting if the file fails to open (it still returns RETURN_FALSE) If no one has a problem, I'll commit. Where is the patch? Derick -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 04, 2002 9:54 PM To: [EMAIL PROTECTED] Subject: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false ID: 20822 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Documentation problem Operating System: linux PHP Version: 4.2.3 New Comment: maybe its also worth mentioning that getimagesize() spews out an error if the filesize() of the file is 0 bytes :/ - this isnt so nice :/ Previous Comments: --- - [2002-12-04 20:47:55] [EMAIL PROTECTED] 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)) --- - -- Edit this bug report at http://bugs.php.net/?id=20822edit=1 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- --- -- Derick Rethans http://derickrethans.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ --- -- -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] RE: [PHP-DEV] RE: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false
The return false part is ok but why not showing the warnings from fopen? Well, the issue here is in the bugreport... It's not an issue of PHP throwing a warning when a file doesn't exist and is attempted to be opened, but it was throwing the error if the filesize was zero.. I could see that being annoying. I've got no problem leaving the warning in I just feel that the function should consistently return false on error. John -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] RE: [PHP-DEV] RE: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false
At 13:34 05.12.2002, John Coggeshall wrote: The return false part is ok but why not showing the warnings from fopen? Well, the issue here is in the bugreport... It's not an issue of PHP throwing a warning when a file doesn't exist and is attempted to be opened, but it was throwing the error if the filesize was zero.. I could see that being annoying. I've got no problem leaving the warning in I just feel that the function should consistently return false on error. John Ok, i just commited a patch that made *all* return values FALSE but left the messages in which i think should be discussed a little bit more. From my point of view accessing a file should result in an error if the file cannot be opened or in case of GetImageSize() a file operation cannot be executed. For example i would expect GetImageSize() to show an error if the information cannot be retrieved due to file corruptions. marcus -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] RE: [PHP-DEV] RE: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false
Marcus Börger wrote: From my point of view accessing a file should result in an error if the file cannot be opened or in case of GetImageSize() a file operation cannot be executed. For example i would expect GetImageSize() to show an error if the information cannot be retrieved due to file corruptions. I agree. Absolutely. Masking bona fide file operation errors would be a huge mistake, IMHO. Regards Mike Robinson -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] Re: [PHP-DEV] RE: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false
From my point of view accessing a file should result in an error if the file cannot be opened or in case of GetImageSize() a file operation cannot be executed. For example i would expect GetImageSize() to show an error if the information cannot be retrieved due to file corruptions. I agree. Absolutely. Masking bona fide file operation errors would be a huge mistake, IMHO. I personally dissagree here - an error is a bit harsh if it doesn't hinder execution - I dont see anything in getimagesize() which should return E_ERROR - only E_NOTICE if the file is corrupt, unless I'm missing something. -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DOC] Re: [PHP-DEV] RE: [PHP-DOC] #20822 [Com]: getimagesize() returning null instead of false
At 03:02 PM 12/5/02 +0100, Tit \Black\ Petric wrote: From my point of view accessing a file should result in an error if the file cannot be opened or in case of GetImageSize() a file operation cannot be executed. For example i would expect GetImageSize() to show an error if the information cannot be retrieved due to file corruptions. I agree. Absolutely. Masking bona fide file operation errors would be a huge mistake, IMHO. I personally dissagree here - an error is a bit harsh if it doesn't hinder execution - I dont see anything in getimagesize() which should return E_ERROR - only E_NOTICE if the file is corrupt, unless I'm missing something. If you don't want to see the filesystem error use @ to hide them. Having filesystem errors available makes troubleshooting easier. If GetImageSize never returns them, how do you figure out what is wrong when you it returns false? Rick -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php