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#1179 function checkwordblock bug blocks all edits if last block is empty
Security
2007-07-07furun
If the last lines in a wordblock.conf are empty or # comments, it is possible that the last $blocks produce a empty $re, $re[0] == ''.
In this case, all text will by blocked as Spam by the null word ''.
A code like this is a bugfix
if ($re[0] == '') return false;
or if (empty($re)) return false; //??? maybe
Test this.
The length of each chunk is 200 words, lines.
Create a wordblock.conf file with 201 lines. And let only the last 3 lines empty or # comment, then this lines will by deletet out by
if(empty($block)) continue;
the last block then is,
empty($re) === true
because there is no word in $re, and produce a
preg_match('#('.join('|',$re).')#si',$text) === true
and any text will by blocked.
this is a error not easy to find, it occurs only sometimes by daly updating the wordblock.conf and using a one list wordblock.local.conf containing empty line(s) at the end, and exactly the last chunk block contains only this empty line(s). chance 200:1 or maybe 50:1 depending on how many empty lines ar at the end of the wordblock list.
i think this code is the most clean version for PHP (i am programmer bat not advanced in PHP)
if (!empty($re)) {
if(preg_match('#('.join('|',$re).')#si',$text)) {
return true;
}
}
(an extra idea: wordblock cold by used too for page-names and user-names, too block out spamwords like viag...poke... and s3x-words.)