Skip to content

Commit 4cf1a38

Browse files
committed
bug symfony#48823 [Cache] Fix possibly null value passed to preg_match() in RedisTrait (chalasr)
This PR was merged into the 5.4 branch. Discussion ---------- [Cache] Fix possibly null value passed to preg_match() in RedisTrait | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 89e6c2f [Cache] Fix possibly null value passed to preg_match() in RedisTrait
2 parents 51bbdc8 + 89e6c2f commit 4cf1a38

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)