Skip to content

Commit

Permalink
Suppress notification if error_reporting() has narrowed
Browse files Browse the repository at this point in the history
If the error_reporting() setting has narrowed since Airbrake's error
handler was installed, respect the new setting. This also resolves the
issue of errors suppressed with the "@" operator being reported to
Airbrake. (Fixes airbrake#105)
  • Loading branch information
fuhry committed Jul 13, 2020
1 parent d34f171 commit ff25f49
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public function __construct(\Airbrake\Notifier $notifier)
*/
public function onError($code, $message, $file, $line)
{
// If error_reporting() setting has changed since the ErrorHandler was
// installed, respect the new settings. This also respects the
// @-operator (issue #105)
if ($code !== (error_reporting() & $code)) {
return false;
}

$this->lastError = [
'message' => $message,
'file' => $file,
Expand Down

0 comments on commit ff25f49

Please sign in to comment.