Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e664c81

Browse filesBrowse files
cryptiklemurfabpot
authored andcommitted
Throwing exception if redis and predis unavailable
1 parent 7031b61 commit e664c81
Copy full SHA for e664c81

File tree

1 file changed

+4
-0
lines changed
Filter options

1 file changed

+4
-0
lines changed

‎src/Symfony/Component/Cache/Traits/RedisTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Traits/RedisTrait.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Predis\Connection\Aggregate\PredisCluster;
1717
use Predis\Connection\Aggregate\RedisCluster;
1818
use Predis\Response\Status;
19+
use Symfony\Component\Cache\Exception\CacheException;
1920
use Symfony\Component\Cache\Exception\InvalidArgumentException;
2021

2122
/**
@@ -108,6 +109,9 @@ public static function createConnection($dsn, array $options = array())
108109
$params += $query;
109110
}
110111
$params += $options + self::$defaultConnectionOptions;
112+
if (null === $params['class'] && !extension_loaded('redis') && !class_exists(\Predis\Client::class)) {
113+
throw new CacheException(sprintf('Cannot find the "redis" extension, and "predis/predis" is not installed: %s', $dsn));
114+
}
111115
$class = null === $params['class'] ? (extension_loaded('redis') ? \Redis::class : \Predis\Client::class) : $params['class'];
112116

113117
if (is_a($class, \Redis::class, true)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.