diff --git a/src/Tracy/Debugger/ProductionStrategy.php b/src/Tracy/Debugger/ProductionStrategy.php index 93ddfa2f2..8d9c53862 100644 --- a/src/Tracy/Debugger/ProductionStrategy.php +++ b/src/Tracy/Debugger/ProductionStrategy.php @@ -43,12 +43,13 @@ public function handleException(\Throwable $exception, bool $firstTime): void (fn($logged) => require Debugger::$errorTemplate ?: __DIR__ . '/assets/error.500.phtml')(empty($e)); } elseif (Helpers::isCli()) { - // @ triggers E_NOTICE when strerr is closed since PHP 7.4 - @fwrite(STDERR, "ERROR: {$exception->getMessage()}\n" - . (isset($e) - ? 'Unable to log error. You may try enable debug mode to inspect the problem.' - : 'Check log to see more info.') - . "\n"); + if (is_resource(STDERR)) { + fwrite(STDERR, "ERROR: {$exception->getMessage()}\n" + . (isset($e) + ? 'Unable to log error. You may try enable debug mode to inspect the problem.' + : 'Check log to see more info.') + . "\n"); + } } }