Skip to content
Permalink
Browse files

Debugger: implemented support for E_COMPILE_WARNING

Errors E_COMPILE_WARNING are not handled by user error handler.
  • Loading branch information
dg committed Nov 28, 2019
1 parent 9535542 commit db512d7ea28f8f50a5b2c7428195006a03882006
Showing with 13 additions and 0 deletions.
  1. +9 −0 src/Tracy/Debugger/Debugger.php
  2. +4 −0 tests/Tracy/Debugger.warnings.html.phpt
@@ -263,6 +263,9 @@ public static function shutdownHandler(): void
$error = error_get_last();
if (in_array($error['type'] ?? null, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE, E_RECOVERABLE_ERROR, E_USER_ERROR], true)) {
self::exceptionHandler(Helpers::fixStack(new ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line'])));
} elseif (($error['type'] ?? null) === E_COMPILE_WARNING) {
error_clear_last();
self::errorHandler($error['type'], $error['message'], $error['file'], $error['line']);
}
self::$reserved = null;
@@ -353,6 +356,12 @@ public static function exceptionHandler(\Throwable $exception): void
*/
public static function errorHandler(int $severity, string $message, string $file, int $line, array $context = null): ?bool
{
$error = error_get_last();
if (($error['type'] ?? null) === E_COMPILE_WARNING) {
error_clear_last();
self::errorHandler($error['type'], $error['message'], $error['file'], $error['line']);
}
if (self::$scream) {
error_reporting(E_ALL);
}
@@ -46,6 +46,10 @@ Warning: Unsupported declare \'foo\' in %a% on line %d%%A%', $output);
<td class="tracy-right">1%a%</td>
<td><pre>PHP Warning: %a% in %a%:%d%</a></pre></td>
</tr>
<tr>
<td class="tracy-right">1%a%</td>
<td><pre>PHP Compile Warning: Unsupported declare &#039;foo&#039; in %a%:%d%</a></pre></td>
</tr>
</table>
</div>%A%', $panelContent);
echo 'OK!'; // prevents PHP bug #62725

0 comments on commit db512d7

Please sign in to comment.
You can’t perform that action at this time.