diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 1393797711883..62277c9bbf166 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -2029,7 +2029,7 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
$storeDefinitions = [];
foreach ($resourceStores as $resourceStore) {
$storeDsn = $container->resolveEnvPlaceholders($resourceStore, null, $usedEnvs);
- if (!$usedEnvs && !str_contains($resourceStore, ':') && !\in_array($resourceStore, ['flock', 'semaphore', 'in-memory'], true)) {
+ if (!$usedEnvs && !str_contains($resourceStore, ':') && !\in_array($resourceStore, ['flock', 'semaphore', 'in-memory', 'null'], true)) {
$resourceStore = new Reference($resourceStore);
}
$storeDefinition = new Definition(PersistingStoreInterface::class);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/lock_named.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/lock_named.php
index cbfead83000a3..c03a7fa71aa75 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/lock_named.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/lock_named.php
@@ -14,5 +14,6 @@
'qux' => '%env(REDIS_DSN)%',
'corge' => 'in-memory',
'grault' => 'mysql:host=localhost;dbname=test',
+ 'garply' => 'null',
],
]);
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/lock_named.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/lock_named.xml
index 7c48fa447f59c..b8d4b4a3fe347 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/lock_named.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/lock_named.xml
@@ -20,6 +20,7 @@
%env(REDIS_DSN)%
in-memory
mysql:host=localhost;dbname=test
+ null
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/lock_named.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/lock_named.yml
index 04ec9fc07f740..63157403069c1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/lock_named.yml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/lock_named.yml
@@ -14,3 +14,4 @@ framework:
qux: "%env(REDIS_DSN)%"
corge: in-memory
grault: mysql:host=localhost;dbname=test
+ garply: 'null'
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
index 4bccbb71ff601..016ae507badc8 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php
@@ -2460,6 +2460,10 @@ public function testNamedLocks()
self::assertTrue($container->hasDefinition('lock.grault.factory'));
$storeDef = $container->getDefinition($container->getDefinition('lock.grault.factory')->getArgument(0));
self::assertSame('mysql:host=localhost;dbname=test', $storeDef->getArgument(0));
+
+ self::assertTrue($container->hasDefinition('lock.garply.factory'));
+ $storeDef = $container->getDefinition($container->getDefinition('lock.garply.factory')->getArgument(0));
+ self::assertSame('null', $storeDef->getArgument(0));
}
public function testLockWithService()