Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Cache] Fixed incorrect usage of UNLINK with PHPRedis with Redis < 4.0#39298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
carsonbot commentedDec 3, 2020
Hey! I see that this is your first PR. That is great! Welcome! Symfony has acontribution 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 |
Uh oh!
There was an error while loading.Please reload this page.
derrabus commentedDec 3, 2020
Thank you very much for working on this issue. Because the 5.2 branch is affected by this bug, please base your PR on the 5.2 branch. |
jderusse left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
From the Redis documentation this is available since Redis 4.0https://redis.io/commands/unlink
I believe the fix should also be applied to Predis. Right?
Looks like thePredis\Command\Redis\UNLINK does not exists. /cc@jonashrem
colinpieper commentedDec 4, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Here's the pull request that introduced these changes:#37993. The UNLINK command is a pending pull request to Predis (seepredis/predis#666) and not yet available, but might be in the future if/when it's approved. There's a check to see if that class exists or it will fall back to the DELETE-command, so there currently aren't any negative side effects in keeping it as far as I can see. These changes will also need to be applied to the following two files:
I'll implement those corrections soon. |
nicolas-grekas commentedDec 7, 2020
Which version of phpredis are you using? |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looking at@jderusse's comment at#39280 (comment), we should handle the case where the call returnsfalse instead.
11d1bb9 to4907be1Compare4907be1 to9363f3bComparenicolas-grekas commentedDec 8, 2020
Thank you@Wickex. |
Uh oh!
There was an error while loading.Please reload this page.
Currently, deleting cache keys is broken for users using PhpRedis with Redis-server < 4.0.0. The current implementation expects PhpRedis to throw an exception if the 'unlink'-function is used but unavailable, after which it's supposed to switch to using the 'del'-function. Using the 'unlink'-function on lower Redis-server versions seems to not throw an exception, but instead it appears to silently fail.
This pull request changes this behavior and checks the Redis-server version instead. If the version is 4.0 or higher, it uses the unlink function. If not, it uses the del-function.
Also seehttps://redis.io/commands/unlink > "Available since 4.0.0".
(Footnote: this is one of my first times contributing to an open-source project and my first time contributing to Symfony. I've tried following the guidelines, but please let me know if I missed anything. I'm unsure how I would go about unit testing this specific bugfix due to it being dependent on the Redis version, so I omitted it. Please let me know if a unit test is indeed required for this and if so, let me know if you have any suggestions on how to go about that.)