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
This commit is contained in:
parent
3cb507ba33
commit
4a01cd85bc
@ -116,7 +116,7 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version);
|
$apcu = new ApcuAdapter($namespace, (int) $defaultLifetime / 5, $version);
|
||||||
if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
|
if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) {
|
||||||
$apcu->setLogger(new NullLogger());
|
$apcu->setLogger(new NullLogger());
|
||||||
} elseif (null !== $logger) {
|
} elseif (null !== $logger) {
|
||||||
$apcu->setLogger($logger);
|
$apcu->setLogger($logger);
|
||||||
|
@ -13,6 +13,7 @@ namespace Symfony\Component\PropertyAccess;
|
|||||||
|
|
||||||
use Psr\Cache\CacheItemPoolInterface;
|
use Psr\Cache\CacheItemPoolInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Psr\Log\NullLogger;
|
||||||
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
||||||
use Symfony\Component\Cache\Adapter\ApcuAdapter;
|
use Symfony\Component\Cache\Adapter\ApcuAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\NullAdapter;
|
use Symfony\Component\Cache\Adapter\NullAdapter;
|
||||||
@ -928,7 +929,9 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $version);
|
$apcu = new ApcuAdapter($namespace, $defaultLifetime / 5, $version);
|
||||||
if (null !== $logger) {
|
if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) {
|
||||||
|
$apcu->setLogger(new NullLogger());
|
||||||
|
} elseif (null !== $logger) {
|
||||||
$apcu->setLogger($logger);
|
$apcu->setLogger($logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user