8000 Set a NullLogger in ApcuAdapter when Apcu is disabled in CLI · symfony/symfony@4a01cd8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a01cd8

Browse files
committed
Set a NullLogger in ApcuAdapter when Apcu is disabled in CLI
Same check as in https://github.com/symfony/symfony/pull/23390/files#diff-a5185cd58702e8e073786794a423cb27R112
1 parent 3cb507b commit 4a01cd8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static function createSystemCache($namespace, $defaultLifetime, $version,
116116
}
117117

118118
$apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version);
119-
if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
119+
if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) {
120120
$apcu->setLogger(new NullLogger());
121121
} elseif (null !== $logger) {
122122
$apcu->setLogger($logger);

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Psr\Cache\CacheItemPoolInterface;
1515
use Psr\Log\LoggerInterface;
16+
use Psr\Log\NullLogger;
1617
use Symfony\Component\Cache\Adapter\AdapterInterface;
1718
use Symfony\Component\Cache\Adapter\ApcuAdapter;
1819
use Symfony\Component\Cache\Adapter\NullAdapter;
@@ -928,7 +929,9 @@ public static function createCache($namespace, $defaultLifetime, $version, Logge
928929
}
929930

930931
$apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $version);
931-
if (null !== $logger) {
932+
if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) {
933+
$apcu->setLogger(new NullLogger());
934+
} elseif (null !== $logger) {
932935
$apcu->setLogger($logger);
933936
}
934937

0 commit comments

Comments
 (0)
0