[pLog-svn] r3539 - plog/trunk/class/data/validator/rules

oscar at devel.lifetype.net oscar at devel.lifetype.net
Tue Jun 6 13:15:21 GMT 2006


Author: oscar
Date: 2006-06-06 13:15:19 +0000 (Tue, 06 Jun 2006)
New Revision: 3539

Modified:
   plog/trunk/class/data/validator/rules/rangerule.class.php
Log:
another fundamental bug in a class that we should theoretically trust... I think this can go on like this, we should
start writing unit tests for this kind of classes because we keep finding bugs in them
after all this time.


Modified: plog/trunk/class/data/validator/rules/rangerule.class.php
===================================================================
--- plog/trunk/class/data/validator/rules/rangerule.class.php	2006-06-06 01:17:00 UTC (rev 3538)
+++ plog/trunk/class/data/validator/rules/rangerule.class.php	2006-06-06 13:15:19 UTC (rev 3539)
@@ -77,14 +77,15 @@
          */
         function validate($value)
         {
-            $len = strlen($value);
+            //$len = strlen($value);
+            $intValue = (int)$value;
 
-            if ($len < $this->_minValue)
+            if ($intValue < $this->_minValue)
             {
                 $this->_setError(ERROR_RULE_TOO_SMALL);
                 return false;
             }
-            else if ($this->_maxValue != 0 && $len > $this->_maxValue)
+            else if ($this->_maxValue != 0 && $intValue > $this->_maxValue)
             {
                 $this->_setError(ERROR_RULE_TOO_LARGE);
                 return false;



More information about the pLog-svn mailing list