Zend Framework

Zend_Form context missing in validator chains

Details

  • Type: Patch Patch
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.8.4
  • Fix Version/s: 1.9.1
  • Component/s: Zend_Validate
  • Labels:
    None

Description

In the current release validator chains loose the context parameter, making it impossible to use in Zend_Form:

require_once 'Zend/Validate.php';
require_once 'Zend/Validate/Abstract.php';

class XYZValidator extends Zend_Validate_Abstract {
    public function isValid($value, $context = null) {
        return $value == 'value' && is_array($context) && array_diff($context, array('foo' => 'bar')) === array();
    }
}

$validate = new Zend_Validate();
$validate->addValidator(new XYZValidator());

var_dump($validate->isValid('value', array('foo' => 'bar'))); // should be true but is false

My patch

  • enables passing arbitrary count of parameters to the validator chain proxying those parameters to the validators.
  • has been unit-tested to not break BC.
  • provides a unit-test to check for those context parameters.

Issue Links

Activity

Hide
Thomas Weidner added a comment -

Closing as Won't Fix as for the same reason as mentioned within ZF-6506.

Show
Thomas Weidner added a comment - Closing as Won't Fix as for the same reason as mentioned within ZF-6506.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: