Skip to content

Commit 04b0574

Browse files
bug symfony#44232 [Cache] fix connecting to local Redis sockets (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [Cache] fix connecting to local Redis sockets | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony#44215 | License | MIT | Doc PR | - Commits ------- 954db3f [Cache] fix connecting to local Redis sockets
2 parents 73d6281 + 954db3f commit 04b0574

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/Cache/Tests/Adapter/RedisAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function provideFailedCreateConnection(): array
9696
['redis://localhost:1234'],
9797
['redis://foo@localhost'],
9898
['redis://localhost/123'],
99+
['redis:///some/local/path'],
99100
];
100101
}
101102

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public static function createConnection($dsn, array $options = [])
151151
if (preg_match('#/(\d+)$#', $params['path'], $m)) {
152152
$params['dbindex'] = $m[1];
153153
$params['path'] = substr($params['path'], 0, -\strlen($m[0]));
154-
} else {
154+
} elseif (isset($params['host'])) {
155155
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s", the "dbindex" parameter must be a number.', $dsn));
156156
}
157157
}

0 commit comments

Comments
 (0)