Skip to content

Commit 5dccc92

Browse files
committed
fix error on phrase search with no results. fixes dokuwiki#4355
When no pages for a phrase can be found, eg. because the index is still empty, end($stack) returns false instead of an array, breaking the following loop.
1 parent 6373474 commit 5dccc92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

inc/fulltext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ function _ft_pageSearch(&$data)
9595
case 'P-:': // phrase
9696
$phrase = substr($token, 3);
9797
// since phrases are always parsed as ((W1)(W2)...(P)),
98-
// the end($stack) always points the pages that contain
98+
// the end($stack) always points at the pages that contain
9999
// all words in this phrase
100-
$pages = end($stack);
100+
$pages = $stack ? end($stack) : [];
101101
$pages_matched = [];
102102
foreach (array_keys($pages) as $id) {
103103
$evdata = [

0 commit comments

Comments
 (0)