Offset error in relevanssi_create_excerpt
-
In the function relevanssi_create_excerpt in lib/excerpts-highlights.php, there’s an iteration error that causes a bunch of ‘Notice: Undefined offset’ warnings if you’re in strict mode. The offending code is here:
line 145
for ($i = 0; $i <= count($positions); $i++)
should befor ($i = 0; $i < count($positions); $i++)
, since we’re iterating from 0 to count, there will never be an item at $positions[count($positions)] — the highest index would be at $positions[count($positions) – 1], so the less than does the job.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Offset error in relevanssi_create_excerpt’ is closed to new replies.