Edit report at https://bugs.php.net/bug.php?id=60957&edit=1

 ID:                 60957
 Comment by:         php-dev at zerocue dot com
 Reported by:        joel at purerave dot com
 Summary:            if function returns false on error, don't emit a
                     warning
 Status:             Open
 Type:               Feature/Change Request
 Package:            Filesystem function related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

On my box with 54RC7, executing filemtime on a file that doesn't exist 
executing 
10,000 times takes 6.5 seconds, using the @ to suppress the error takes 0.058 
seconds so suppression with @ is pretty fast.  I'd say this is bogus.

If you're still logging the error with an @ because you have a custom error 
logger 
you can detect the use of the @ from within the error catch function.


Previous Comments:
------------------------------------------------------------------------
[2012-02-02 16:58:24] joel at purerave dot com

Description:
------------
functions that return FALSE on error should not also emit a warning.

Example: filemtime(). it is sufficient to check if the file exists and retrieve 
the mtime by doing:
if ($mtime = filemtime()) {
 echo date('ymd', $mtime);
} else {
 echo 'file does not exist';
}

supressing the warning with "@" is slow and generates an error in the log (also 
slow). checking if the file exists before retrieving the mtime is also wasteful.

Expected result:
----------------
filemtime and other functions that emit a warning on error when false is also 
returned should not emit a warning.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60957&edit=1

Reply via email to