Searched hist:e08e2789d1747042763bf9977fc0a7c0dba75785 (Results 1 – 1 of 1) sorted by relevance
| /dokuwiki/inc/ |
| H A D | fulltext.php | e08e2789d1747042763bf9977fc0a7c0dba75785 Sun Feb 04 00:31:16 UTC 2024 Bheesham Persaud <171007+bheesham@users.noreply.github.com> inc/fulltext Result from splice could be empty
The code for `AND` and `OR` assumes the call to splice will always return 2 elements, which isn't the case if no terms are found.
Example log messages:
PHP Warning: Undefined array key 0 in .../dokuwiki/inc/fulltext.php on line 134 PHP Warning: Undefined array key 1 in .../dokuwiki/inc/fulltext.php on line 134 PHP Warning: foreach() argument must be of type array|object, null given in .../dokuwiki/inc/fulltext.php on line 614
Simplified example, via `php -a`:
php > $arr = []; php > [$a, $b] = array_splice($arr, -2); PHP Warning: Undefined array key 0 in php shell code on line 1 PHP Warning: Undefined array key 1 in php shell code on line 1
To clear the warning we check if the result is empty and break early, otherwise we pass the result into `ft_resultCombine` or `ft_resultUnite`, which both handle the length 1 arrays.
|