fix(error): harden logging, i18n, a11y and handler tests

This commit is contained in:
2026-03-24 22:00:14 +01:00
parent 44a357dfc4
commit a0d816caaa
10 changed files with 515 additions and 100 deletions

View File

@@ -40,8 +40,10 @@ final class ErrorHandler
self::$reservedMemory = null;
// Discard any partial output from the failed request.
while (ob_get_level() > 0) {
ob_end_clean();
if (!self::isPhpUnitRuntime()) {
while (ob_get_level() > 0) {
ob_end_clean();
}
}
// Set HTTP 500 if no error status has been set yet.
@@ -187,4 +189,9 @@ final class ErrorHandler
echo "\n" . $exception->getMessage() . "\n" . $exception->getTraceAsString() . "\n";
}
}
private static function isPhpUnitRuntime(): bool
{
return defined('PHPUNIT_COMPOSER_INSTALL') || defined('__PHPUNIT_PHAR__');
}
}