ZF-12195: Zend_Validate_Callback does not support validation context


Some validators like Identical make use of validation context passed as a second parameter to isValid() method. Apparently Callback passes options as a second parameter. Sometimes when you write a validator just for one situation you do not want to subclass Zend_Validate_Abstract but use Callback and may need access to the context for rules dependent on another fields' values.


Oops it seems that it does support context since options are merged with $input and $context like this: $options = $this->getOptions(); $callback = $this->getCallback(); $args = func_get_args(); $options = array_merge($args, $options);

but the entry in User Guide is incorrect… The example says: function myMethod($value, $option) but it realy should be function myMethod($value, $context, $option) or better myMethod($value, $context, $option1, $option2, ...)