I'm not really sure why this is happening, and there is only one search phrase that produces it, so rather than patch it I'm asking here if anyone has any thoughts. I'm also not sure what is relevant so I'm documenting the evidence only
My search is three words (though another three word search doesn't produce the error, and removing either of the clean_words doesn't produce the error either).
eg: alpha beta gamma
For one result (of about 30) clean_words matches twice in the same place. The match is a combination of the clean words joined by underscores
eg: $clean_words is (alpha, gamma) and the matches are (alpha_beta_gamma_delta, alpha_beta_gamma_delta).
The resulting section and section_length arrays have different lengths and therefore I get the undefined offset error when looping over the result. As the contents of section are two offsets in the same place if I array_unique() them I get arrays of the correct length and therefore no error.
From fuzzysearch.module
409 asort($section);
410 ksort($section_length);
411 $section = array_unique(array_values($section));
412 $section_length = array_values($section_length);
Is this something that we need a check for? Is there another (rarer) situation in which array_unique() won't be enough?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | fuzzysearch-1874040-3.patch | 500 bytes | mario steinitz |
Comments
Comment #0.0
queenvictoria commentedFix the actual clean words and add other symptom.
Comment #1
mario steinitzI'll set this issue to 'Postponed (maintainer needs more info)', as I'm missing the search value you've been talking of six years ago.
If you still can remember your scenario, I'd love to provide an according fix.
Comment #2
mario steinitzI was actually able to reproduce the behavior with any word that matches two or more of the keywords. Setting back to active and continuing investigation.
Comment #3
mario steinitzThe attached patch incorporates the suggested code change of @queenvictoria.
I ran diverse tests and couldn't reproduce the undefined offset errors anymore.
Comment #5
mario steinitzFixed and committed. Thanks for pointing out this issue and suggesting your workaround!