Skip to content

Commit 89e6c2f

Browse files
committed
[Cache] Fix possibly null value passed to preg_match() in RedisTrait
1 parent 51bbdc8 commit 89e6c2f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public static function createConnection(string $dsn, array $options = [])
237237
restore_error_handler();
238238
}
239239
if (!$isConnected) {
240-
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
240+
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? '', $error) ? sprintf(' (%s)', $error[1]) : '';
241241
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
242242
}
243243

0 commit comments

Comments
 (0)