Skip to content

Commit c20c511

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Fix tests [Lock] Fix StoreFactory to accept same DSN syntax as AbstractAdapter [Serializer][Minor] Fix exception message
2 parents efb1730 + 9d7e814 commit c20c511

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Store/StoreFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ public static function createStore($connection)
6969
case 'semaphore' === $connection:
7070
return new SemaphoreStore();
7171

72-
case 0 === strpos($connection, 'redis://'):
73-
case 0 === strpos($connection, 'rediss://'):
74-
case 0 === strpos($connection, 'memcached://'):
72+
case 0 === strpos($connection, 'redis:'):
73+
case 0 === strpos($connection, 'rediss:'):
74+
case 0 === strpos($connection, 'memcached:'):
7575
if (!class_exists(AbstractAdapter::class)) {
7676
throw new InvalidArgumentException(sprintf('Unsupported DSN "%s". Try running "composer require symfony/cache".', $connection));
7777
}
78-
$storeClass = 0 === strpos($connection, 'memcached://') ? MemcachedStore::class : RedisStore::class;
78+
$storeClass = 0 === strpos($connection, 'memcached:') ? MemcachedStore::class : RedisStore::class;
7979
$connection = AbstractAdapter::createConnection($connection, ['lazy' => true]);
8080

8181
return new $storeClass($connection);

Tests/Store/StoreFactoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ public function validConnections()
6363
}
6464
if (class_exists(\Memcached::class) && class_exists(AbstractAdapter::class)) {
6565
yield ['memcached://server.com', MemcachedStore::class];
66+
yield ['memcached:?host[localhost]&host[localhost:12345]', MemcachedStore::class];
6667
}
6768
if (class_exists(\Redis::class) && class_exists(AbstractAdapter::class)) {
6869
yield ['redis://localhost', RedisStore::class];
6970
yield ['redis://localhost?lazy=1', RedisStore::class];
7071
yield ['redis://localhost?redis_cluster=1', RedisStore::class];
7172
yield ['redis://localhost?redis_cluster=1&lazy=1', RedisStore::class];
73+
yield ['redis:?host[localhost]&host[localhost:6379]&redis_cluster=1', RedisStore::class];
7274
}
7375
if (class_exists(\PDO::class)) {
7476
yield ['sqlite:/tmp/sqlite.db', PdoStore::class];

0 commit comments

Comments
 (0)