Closed (fixed)
Project:
Redis
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Aug 2015 at 15:46 UTC
Updated:
24 Aug 2015 at 14:14 UTC
Jump to comment: Most recent
Currently both deleteInHash() implementations Redis_Path_PhpRedis::deleteInHash() as well as Redis_Path_Predis::deleteInHash() use an invalid condition to figure out if something to delete was found:
if ($index = array_search($hvalue, $existing)) { won't work if the found key is 0.
This leads to artefacts in the path handling e.g. a deleted alias still will find the source, thus the cache will be pre-set and it looks like the alias is still available.
Use if (($index = array_search($hvalue, $existing)) !== FALSE) {
Reviews needed.
| Comment | File | Size | Author |
|---|---|---|---|
| redis-fix-deleteInHash.patch | 1.16 KB | das-peter |
Comments
Comment #2
pounardNice catch, thanks for reporting.
Comment #4
pounardThanks for this, I also added basic unit tests for path replacement, and fixed in both Predis and PhpRedis implementations, along with few cleanups.
Comment #5
das-peter commented@pounard Awesome, thank you very much!
You shouldn't have attributed the authorship for the TestCases to me - now people will expect tests from me :P
Comment #6
pounardSo you never write unit tests ? Now I know your secret.
I just did credit both of us because I wrote the tests, but you did the hard part that was finding the issue and providing a working patch, so really thank you very much for that!