From 30bee20a0af2fdde271f6e103e7497fdc9f6d62b Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 17 Jun 2026 14:58:58 +0800 Subject: [PATCH] fix: remove @ error suppression from echo/fwrite/fflush calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `@echo` is invalid PHP syntax — echo is a language construct, not a function, so the @ operator cannot be applied to it. This causes a parse error on some PHP versions/runtimes. The recursion guard ($in_log) added in 1.1.7 already prevents infinite loops when STDOUT/STDERR is broken, so @ suppression is unnecessary. Remove @ from echo, fwrite, and fflush calls. Version bumped from 1.1.8 to 1.1.9. --- src/ZM/Logger/ConsoleLogger.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ZM/Logger/ConsoleLogger.php b/src/ZM/Logger/ConsoleLogger.php index 5c20981..4ea61aa 100644 --- a/src/ZM/Logger/ConsoleLogger.php +++ b/src/ZM/Logger/ConsoleLogger.php @@ -10,7 +10,7 @@ use Psr\Log\LogLevel; class ConsoleLogger extends AbstractLogger { - public const VERSION = '1.1.8'; + public const VERSION = '1.1.9'; /** * 日志输出格式 @@ -258,14 +258,14 @@ class ConsoleLogger extends AbstractLogger try { // use stream if ($this->stream) { - @fwrite($this->stream, $output); - @fflush($this->stream); + fwrite($this->stream, $output); + fflush($this->stream); } else { if ($level <= 4 && $this->use_stderr) { - @fwrite(STDERR, $output); + fwrite(STDERR, $output); } else { // use plain text output - @echo $output; + echo $output; } } } finally {