Compare commits

...

3 Commits

Author SHA1 Message Date
Pavel Shevaev 4dc8093881 Adding exception source file and line in digest message
Publish PHP Package / docker (push) Successful in 7s Details
2025-02-27 22:20:38 +03:00
Pavel Shevaev 654c11f8d9 Filtering all error lines
Publish PHP Package / docker (push) Successful in 7s Details
2025-02-25 18:10:18 +03:00
Pavel Shevaev 506210b757 Fixing suppressed errors handling for PHP8
Publish PHP Package / docker (push) Successful in 6s Details
2024-05-02 12:12:47 +03:00
1 changed files with 9 additions and 3 deletions

View File

@ -5,8 +5,10 @@ function _gamectl_error_handler($errno, $errstr, $errfile, $errline)
if($errno == E_STRICT)
return;
// @ sign temporary disabled error reporting
if(error_reporting() == 0)
$PHP_8_SUPPRESSED = E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_RECOVERABLE_ERROR | E_PARSE;
$err_rep = error_reporting();
// check if error was suppressed by @
if($err_rep === 0 || $err_rep === $PHP_8_SUPPRESSED)
return;
$err = "Error happened: $errno, $errstr, $errfile, $errline\n";
@ -20,8 +22,12 @@ function _gamectl_exception_handler($e)
//let's filter out too stack traces which are printed anyway
foreach($lines as $idx => $line)
{
if($idx === 0)
{
$line = 'Exception in ' . $e->getFile() . ':' . $e->getLine() . "\n" . $line;
}
if($idx > 0 && preg_match('~^#\d+\s+~', $line))
break;
continue;
$digest .= $line . "\n";
}
$digest = trim($digest);