3 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
Jerry Ma
d13c8fb85f Update ConsoleLogger.php 2026-06-17 15:53:31 +09:00
crazywhalecc
c21ddda192 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:53:05 +08:00
2 changed files with 9 additions and 9 deletions

View File

@@ -25,7 +25,7 @@
],
"minimum-stability": "stable",
"require": {
"php": "^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1",
"php": "^7.2 || ^7.3 || ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4 || ^8.5",
"psr/log": "^1 || ^2 || ^3",
"symfony/polyfill-mbstring": "^1.0"
},
@@ -37,9 +37,9 @@
"ext-mbstring": "Use C/C++ extension instead of polyfill will be more efficient"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.2",
"phpstan/phpstan": "^1.1",
"phpunit/phpunit": "^8.5 || ^9.0",
"friendsofphp/php-cs-fixer": "^3.64",
"phpstan/phpstan": "^1.12",
"phpunit/phpunit": "^9.0",
"roave/security-advisories": "dev-latest",
"brainmaestro/composer-git-hooks": "^2.8"
},

View File

@@ -10,7 +10,7 @@ use Psr\Log\LogLevel;
class ConsoleLogger extends AbstractLogger
{
public const VERSION = '1.1.7';
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 {