1 Commits

Author SHA1 Message Date
crazywhalecc
30bee20a0a fix: remove @ error suppression from echo/fwrite/fflush calls
`@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.
2026-06-17 14:59:32 +08:00

View File

@@ -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 {