Skip to content
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
8 changes: 4 additions & 4 deletions src/Symfony/Component/Lock/Store/StoreFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this.

The purpose of this check is to avoid failing tests when the extension is not installed.

By checking if Predis is installed (which is always true because in require-dev) this breaks the initial check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 6a79f3e

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];
Expand Down