phpzend-frameworkzend-formzend-validate

Zend_Validate_GreaterThan ignores equal values


I have the next validation:

$gvGreaterThanPvValidate = new Zend_Validate_GreaterThan(array('min' => 100));
$gvGreaterThanPvValidate->setMessage('GV should be greater than PV or equal');
$gv->addValidator($gvGreaterThanPvValidate);

According the Zend documentation it should returns TRUE for value = 100. But for equal value this validator return FALSE. Can you help me? Sorry for my english.


Solution

  • This is the code from GreaterThan validator. So it return false if the numbers are equals.

        if ($this->_min >= $value) {
            $this->_error(self::NOT_GREATER);
            return false;
        }
        return true;
    

    And the doc says : Returns true if and only if $value is greater than min option So if the values are equals it returns false