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 @@
-
+
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);