Warning: Invalid argument supplied for foreach() in /var/www/wiki.qpsmtpd.org/content/inc/fulltext.php on line 273
In tracing this down, the problem for me was that the calling function, in line 115 of inc/fulltext.php:
$matches = idx_lookup(idx_tokenizer($page,$stopwords)); // pagename may contain specials (_ or .)
sets $matches to an empty array. In my case, it was because my page name was only two characters (I believe the index doesn't index two character words, is that right?) My fix was to make my page name longer.
A kludge to get rid of the error is to add:
if(!count($matches)) return $result;
right after the offending line (line 115).
I'd rate this bug as critical or high severity. As far as I can tell, this means that any page with a page name less than 3 characters or a page name that consists of one of the stopwords will not have backlinks working (and this error showing up instead). My fix gets rid of the error, but still doesn't solve the problem because no backlinks will show.
Is there a fast way to do backlinks without searching the fulltext index?
This is probably a much bigger feature request than something to just take care of this bug, but what about implementing some sort of index for the metadata of a page? Then we could just search the metadata instead of searching the page text and then checking the metadata.
Which PHP version do you two run?
I run PHP Version 5.0.4, on Mac OS X 10.4 (Tiger)
Problem exists in -devel revision too:
Warning: Invalid argument supplied for foreach() in .../inc/fulltext.php on line 282
The foreach loop is useless when the array of words found for backlinks is empty.