2 Commits

Author SHA1 Message Date
crazywhalecc
c4367bef61 chore: widen PHP version constraint to 8.5 and bump dev deps
- Add PHP 8.2/8.3/8.4/8.5 to version constraint
- Bump php-cs-fixer from ^3.2 to ^3.64
- Bump phpstan from ^1.1 to ^1.12
- Drop phpunit ^8.5 (EOL), keep ^9.0 only
2026-06-17 14:51:46 +08:00
crazywhalecc
8a72831c5c fix: add recursion guard to prevent 100% CPU when STDOUT/STDERR is broken
When the terminal (IDE) is closed without stopping the framework first,
the PTY is destroyed and STDOUT/STDERR become broken file descriptors.
Any subsequent log call via echo/fwrite fails with E_WARNING, the error
handler catches it and calls the logger again, creating a recursive loop
that consumes 100% CPU.

Changes:
- Add static $in_log recursion guard flag to ConsoleLogger
- Wrap log output (echo/fwrite/fflush) with the guard and @ suppression
- Bump version from 1.1.6 to 1.1.7
2026-06-17 14:30:50 +08:00

View File

@@ -10,7 +10,7 @@ use Psr\Log\LogLevel;
class ConsoleLogger extends AbstractLogger
{
public const VERSION = '1.1.9';
public const VERSION = '1.1.7';
/**
* 日志输出格式
@@ -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 {