Problem/Motivation

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.

Proposed resolution

Use if (($index = array_search($hvalue, $existing)) !== FALSE) {

Remaining tasks

Reviews needed.

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
redis-fix-deleteInHash.patch1.16 KBdas-peter

Comments

das-peter created an issue. See original summary.

pounard’s picture

Nice catch, thanks for reporting.

  • Pierre.R committed 67ea096 on authored by das-peter
    Issue #2546876 by das-peter, pounard: deleteInHash() methods not working...
pounard’s picture

Status: Needs review » Fixed

Thanks for this, I also added basic unit tests for path replacement, and fixed in both Predis and PhpRedis implementations, along with few cleanups.

das-peter’s picture

@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

pounard’s picture

So 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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.