Index: Input.php =================================================================== --- Input.php (revision 23858) +++ Input.php (working copy) @@ -838,8 +838,34 @@ if (!isset($validatorRule[self::PRESENCE])) { $validatorRule[self::PRESENCE] = $this->_defaults[self::PRESENCE]; } - if (!isset($validatorRule[self::ALLOW_EMPTY])) { - $validatorRule[self::ALLOW_EMPTY] = $this->_defaults[self::ALLOW_EMPTY]; + if (!isset($validatorRule[self::ALLOW_EMPTY])) { + $foundNotEmptyValidator = false; + + foreach ($validatorRule as $rule) { + if ($rule === 'NotEmpty') { + $foundNotEmptyValidator = true; + // field may not be empty, we are ready + break 1; + } + + // we must check if it is an object before using instanceof + if (!is_object($rule)) { + // it cannot be a NotEmpty validator, skip this one + continue; + } + + if($rule instanceof Zend_Validate_NotEmpty) { + $foundNotEmptyValidator = true; + // field may not be empty, we are ready + break 1; + } + } + + if (!$foundNotEmptyValidator) { + $validatorRule[self::ALLOW_EMPTY] = $this->_defaults[self::ALLOW_EMPTY]; + } else { + $validatorRule[self::ALLOW_EMPTY] = false; + } } if (!isset($validatorRule[self::MESSAGES])) {