Skip to content

Commit

Permalink
Debugger::errorHandler correctly fill-in error_get_last() when $logSe…
Browse files Browse the repository at this point in the history
…verity is used
  • Loading branch information
dg committed Nov 28, 2019
1 parent 9e39e70 commit 9535542
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Tracy/Debugger/Debugger.php
Expand Up @@ -371,7 +371,6 @@ public static function errorHandler(int $severity, string $message, string $file
throw $e;

} elseif (($severity & error_reporting()) !== $severity) { // muted errors
return false; // calls normal error handler to fill-in error_get_last()

} elseif (self::$productionMode) {
if (($severity & self::$logSeverity) === $severity) {
Expand All @@ -386,7 +385,6 @@ public static function errorHandler(int $severity, string $message, string $file
self::log($e, self::ERROR);
} catch (\Throwable $foo) {
}
return null;

} elseif (
(is_bool(self::$strictMode) ? self::$strictMode : ((self::$strictMode & $severity) === $severity)) // $strictMode
Expand All @@ -410,6 +408,8 @@ public static function errorHandler(int $severity, string $message, string $file
return Helpers::isHtmlMode() || Helpers::isAjax() ? null : false; // false calls normal error handler
}
}

return false; // calls normal error handler to fill-in error_get_last()
}


Expand Down
2 changes: 2 additions & 0 deletions tests/Tracy/Debugger.logSeverity.E_NOTICE.phpt
Expand Up @@ -19,5 +19,7 @@ Debugger::$logSeverity = E_NOTICE;

$variable = $missingVariable;

Assert::same('Undefined variable: missingVariable', error_get_last()['message']);

Assert::count(1, glob(getTempDir() . '/error*.html'));
Assert::count(1, glob(getTempDir() . '/error.log'));

0 comments on commit 9535542

Please sign in to comment.