This is a static dump of issues in the old "Flyspray" bugtracker for DokuWiki. Bugs and feature requests
are now tracked at the issue tracker at Github.
Closed
Fixed
FS#1040 Error with BackLinks
Backend
2007-01-07jamtur01
I have an error when I click a back-link.
Warning: Invalid argument supplied for foreach() in /var/www/wiki.qpsmtpd.org/content/inc/fulltext.php on line 227
Warning: Invalid argument supplied for foreach() in /var/www/wiki.qpsmtpd.org/content/inc/fulltext.php on line 273
2007-01-13orion
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?
2007-01-19orion
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.
2007-02-24andi
Which PHP version do you two run?
2007-02-24orion
I run PHP Version 5.0.4, on Mac OS X 10.4 (Tiger)
2007-03-06gb
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.
shouldn't that be
if ($array_count >0) {
instead of
if (count($result) > 0) {
since $result is a new array, its always 0 length at that point?
2007-03-30gb
You are right, it's $array_count which must be tested, but I'd rather write if ($array_count > 1). Thanks for pointed that. Attached is a darcs patch, if someone wants to try it.