From 4ebbe3d86b8d67ca7d60d2b3c2897cacdaa178b0 Mon Sep 17 00:00:00 2001 From: Joni Halme Date: Tue, 31 Mar 2020 20:28:05 +0300 Subject: [PATCH] [Lock] Fix StoreFactory to accept same DSN syntax as AbstractAdapter --- src/Symfony/Component/Lock/Store/StoreFactory.php | 8 ++++---- .../Component/Lock/Tests/Store/StoreFactoryTest.php | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Lock/Store/StoreFactory.php b/src/Symfony/Component/Lock/Store/StoreFactory.php index b9a5c1e5ca921..2e9172ff99fae 100644 --- a/src/Symfony/Component/Lock/Store/StoreFactory.php +++ b/src/Symfony/Component/Lock/Store/StoreFactory.php @@ -66,13 +66,13 @@ public static function createStore($connection) case 'semaphore' === $connection: return new SemaphoreStore(); - case 0 === strpos($connection, 'redis://'): - case 0 === strpos($connection, 'rediss://'): - case 0 === strpos($connection, 'memcached://'): + case 0 === strpos($connection, 'redis:'): + case 0 === strpos($connection, 'rediss:'): + case 0 === strpos($connection, 'memcached:'): if (!class_exists(AbstractAdapter::class)) { throw new InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require symfony/cache".', $connection)); } - $storeClass = 0 === strpos($connection, 'memcached://') ? MemcachedStore::class : RedisStore::class; + $storeClass = 0 === strpos($connection, 'memcached:') ? MemcachedStore::class : RedisStore::class; $connection = AbstractAdapter::createConnection($connection, ['lazy' => true]); return new $storeClass($connection); diff --git a/src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php b/src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php index 1d88638d26e5f..4e85cdc05f306 100644 --- a/src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php +++ b/src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php @@ -58,12 +58,14 @@ public function validConnections() } if (class_exists(\Memcached::class) && class_exists(AbstractAdapter::class)) { yield ['memcached://server.com', MemcachedStore::class]; + yield ['memcached:?host[localhost]&host[localhost:12345]', MemcachedStore::class]; } - if (class_exists(\Redis::class) && class_exists(AbstractAdapter::class)) { + if ((class_exists(\Redis::class) || class_exists(\Predis\Client::class)) && class_exists(AbstractAdapter::class)) { yield ['redis://localhost', RedisStore::class]; yield ['redis://localhost?lazy=1', RedisStore::class]; yield ['redis://localhost?redis_cluster=1', RedisStore::class]; yield ['redis://localhost?redis_cluster=1&lazy=1', RedisStore::class]; + yield ['redis:?host[localhost]&host[localhost:6379]&redis_cluster=1', RedisStore::class]; } if (class_exists(\PDO::class)) { yield ['sqlite:/tmp/sqlite.db', PdoStore::class]; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy