There are two bugs in Text_CAPTCHA_Numeral Pear Module. Here is the patch.
diff -Nuar Text_CAPTCHA_Numeral-1.3.0.ok/php-pear-Text-CAPTCHA-Numeral.xml Text_CAPTCHA_Numeral-1.3.0/php-pear-Text-CAPTCHA-Numeral.xml --- Text_CAPTCHA_Numeral-1.3.0.ok/php-pear-Text-CAPTCHA-Numeral.xml 2010-10-24 04:16:40.000000000 +0200 +++ Text_CAPTCHA_Numeral-1.3.0/php-pear-Text-CAPTCHA-Numeral.xml 2010-11-18 23:15:05.000000000 +0100 @@ -43,7 +43,7 @@ <file baseinstalldir="Text" md5sum="1b16ce634831d571c8ba2e5819aaf6f9" name="tests/captchanumeral.answerisok.phpt" role="test" /> <file baseinstalldir="Text" md5sum="33de4b4f24e52c2e2ff35645cf1b4e51" name="tests/captchanumeral.firstandsecond.phpt" role="test" /> <file baseinstalldir="Text" md5sum="2f4a58be0ef33a4a112b265c0eb0b5dd" name="tests/captchanumeral.operator.phpt" role="test" /> - <file baseinstalldir="/" md5sum="554c5a360fb6efe189bdb8e73b2e2e70" name="Text/CAPTCHA/Numeral.php" role="php" /> + <file baseinstalldir="/" md5sum="e12804274c4e51bed45b706a49f0efa4" name="Text/CAPTCHA/Numeral.php" role="php" /> <file baseinstalldir="/" md5sum="72851c7bf12ba07412098a83592aee0b" name="Text/CAPTCHA/Numeral/NumeralInterface.php" role="php" /> </dir> </contents> diff -Nuar Text_CAPTCHA_Numeral-1.3.0.ok/Text/CAPTCHA/Numeral.php Text_CAPTCHA_Numeral-1.3.0/Text/CAPTCHA/Numeral.php --- Text_CAPTCHA_Numeral-1.3.0.ok/Text/CAPTCHA/Numeral.php 2010-10-24 04:16:39.000000000 +0200 +++ Text_CAPTCHA_Numeral-1.3.0/Text/CAPTCHA/Numeral.php 2010-11-18 23:13:58.000000000 +0100 @@ -355,7 +355,7 @@ */ private function setOperation($type = null) { - if (!stristr($type, 'F')) { + if (stristr($type, 'F')) { $this->operation = $this->getFirstNumber() . ' ' . $this->operator; } else { $this->operation = $this->getFirstNumber() . ' ' . @@ -514,6 +514,15 @@ ->setSecondNumber($first) ->setOperation(); } + /** + * Get rid of problematic zero result + */ + elseif ($first == $second) { + $this->setFirstNumber($first) + ->setSecondNumber($second-1) + ->setOperation(); + } + $answer = $this->getFirstNumber() - $this->getSecondNumber(); $this->setAnswer($answer);