[Cache] Fix connecting to Redis via a socket file#45281
[Cache] Fix connecting to Redis via a socket file#45281nicolas-grekas merged 1 commit intosymfony:4.4from alebedev80:bug_fix_a_socket_connection_without_port
Conversation
|
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
|
@kbond I did a first PR to Symfony project and had some issues:
|
|
Hey @alebedev80, thanks for contributing! For (1), a few things:
For (2), I think you'll need to run the test suite with the I'm not positive though, let me know if that doesn't work. |
|
@kbond test failed with an error: as i understand test envirionment start a Redis instance
Thank you! |
|
I'll have to ping @nicolas-grekas to help with this. |
|
@nicolas-grekas please help |
nicolas-grekas
left a comment
There was a problem hiding this comment.
I've rebased for 4.4, fixed the patch, and fixed the tests.
|
Thank you @alebedev80. |
|
@nicolas-grekas thank you very much! |
In the commit was done follow changes in Traits/RedisTrait.php(188)
Old code:
$port = $hosts[0]['port'] ?? null;New code:
$port = $hosts[0]['port'] ?? 6379;With DSN "redis:///var/run/redis/redis.sock" raise an error:
Because phpredis doesn't allow socket connections with a port
Error
I added additional validation of connection type (by host or socket). Also I fixed condition when RedisSentinel connection call as it supports connections by host only.