Reputation: 2837
I have several errors in my php error log on code that should be suppressing errors with the @ operator. For example:
@unlink($path.'_expire');
trows an error in the error log that there is no file or directory named "_expire".
This code is in a third party library and I don't want to modify it, I just need php to suppress the error as I think was intended.
My error reporting is set to
error_reporting = E_ALL & ~E_DEPRECATED
Is there a way to do this?
Upvotes: 1
Views: 309
Reputation: 2837
It turns out I was using a separate error handler. I added the following check to my error handler:
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting
return;
}
and now it correctly skips suppressed errors.
source: https://www.php.net/manual/en/function.set-error-handler.php
Upvotes: 2