Skip to content

Commit e7ed9a4

Browse files
committed
[Lock] Fixed StoreFactory to accept same DSN syntax as AbstractAdapter for memcached
1 parent c666647 commit e7ed9a4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Component/Lock/Store/StoreFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public static function createStore($connection)
6868

6969
case 0 === strpos($connection, 'redis:'):
7070
case 0 === strpos($connection, 'rediss:'):
71-
case 0 === strpos($connection, 'memcached://'):
71+
case 0 === strpos($connection, 'memcached:'):
7272
if (!class_exists(AbstractAdapter::class)) {
7373
throw new InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require symfony/cache".', $connection));
7474
}
75-
$storeClass = 0 === strpos($connection, 'memcached://') ? MemcachedStore::class : RedisStore::class;
75+
$storeClass = 0 === strpos($connection, 'memcached:') ? MemcachedStore::class : RedisStore::class;
7676
$connection = AbstractAdapter::createConnection($connection, ['lazy' => true]);
7777

7878
return new $storeClass($connection);

src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function validConnections()
5858
}
5959
if (class_exists(\Memcached::class) && class_exists(AbstractAdapter::class)) {
6060
yield ['memcached://server.com', MemcachedStore::class];
61+
yield ['memcached:?host[localhost]&host[localhost:12345]', MemcachedStore::class];
6162
}
6263
if ((class_exists(\Redis::class) || class_exists(\Predis\Client::class)) && class_exists(AbstractAdapter::class)) {
6364
yield ['redis://localhost', RedisStore::class];

0 commit comments

Comments
 (0)