Skip to content

[PropertyAccess] Deprecate null as allowed value for defaultLifetime argument in createCache method #32241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ private function registerCacheConfiguration(array $config, ContainerBuilder $con

if (!$container->getParameter('kernel.debug')) {
$propertyAccessDefinition->setFactory([PropertyAccessor::class, 'createCache']);
$propertyAccessDefinition->setArguments([null, null, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
$propertyAccessDefinition->setArguments([null, 0, $version, new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
$propertyAccessDefinition->addTag('cache.pool', ['clearer' => 'cache.system_clearer']);
$propertyAccessDefinition->addTag('monolog.logger', ['channel' => 'cache']);
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/PropertyAccess/PropertyAccessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,10 @@ private function getPropertyPath($propertyPath): PropertyPath
*/
public static function createCache($namespace, $defaultLifetime, $version, LoggerInterface $logger = null)
{
if (null === $defaultLifetime) {
@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);
}

if (!class_exists('Symfony\Component\Cache\Adapter\ApcuAdapter')) {
throw new \LogicException(sprintf('The Symfony Cache component must be installed to use %s().', __METHOD__));
}
Expand Down