Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9aac426

Browse files
jschaedlfabpot
authored andcommitted
[PropertyAccess] Deprecate null as allowed value for defaultLifetime argument in createCache method
1 parent b92e4ed commit 9aac426

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con
18651865

18661866
if (!$container->getParameter('kernel.debug')) {
18671867
$propertyAccessDefinition->setFactory([PropertyAccessor::class, 'createCache']);
1868-
$propertyAccessDefinition->setArguments([null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
1868+
$propertyAccessDefinition->setArguments([null, 0, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
18691869
$propertyAccessDefinition->addTag('cache.pool', ['clearer' => 'cache.system_clearer']);
18701870
$propertyAccessDefinition->addTag('monolog.logger', ['channel' => 'cache']);
18711871
} else {

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,10 @@ private function getPropertyPath($propertyPath): PropertyPath
828828
*/
829829
public static function createCache($namespace, $defaultLifetime, $version, LoggerInterface $logger = null)
830830
{
831+
if (null === $defaultLifetime) {
832+
@trigger_error(sprintf('Passing null as "$defaultLifetime" 2nd argument of the "%s()" method is deprecated since Symfony 4.4, pass 0 instead.', __METHOD__), E_USER_DEPRECATED);
833+
}
834+
831835
if (!class_exists('Symfony\Component\Cache\Adapter\ApcuAdapter')) {
832836
throw new \LogicException(sprintf('The Symfony Cache component must be installed to use %s().', __METHOD__));
833837
}

0 commit comments

Comments
 (0)