Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved previous fix for ZF2-558. Previous fix made implicit assumpt…

…ions that could cause issues in subclasses of Element\[Select|MultiCheckbox]
  • Loading branch information...
commit 213be2c885d0588f7aa19ac60755cb10ca6dc778 1 parent 90cfc28
Tim Lieberman authored
View
2  library/Zend/Form/Element/MultiCheckbox.php
@@ -64,7 +64,7 @@ public function setValueOptions(array $options)
$this->valueOptions = $options;
// Update InArray validator haystack
- if (!is_null($this->validator)) {
+ if (!is_null($this->validator) && $this->validator instanceof ExplodeValidator) {
$validator = $this->validator->getValidator();
$validator->setHaystack($this->getValueOptionsValues());
}
View
11 library/Zend/Form/Element/Select.php
@@ -83,8 +83,15 @@ public function setValueOptions(array $options)
// Update InArrayValidator validator haystack
if (!is_null($this->validator)) {
- $validator = $this->validator instanceof InArrayValidator ? $this->validator : $this->validator->getValidator();
- $validator->setHaystack($this->getValueOptionsValues());
+ if ($this->validator instanceof InArrayValidator){
+ $validator = $this->validator;
+ }
+ if ($this->validator instanceof ExplodeValidator){
+ $validator = $this->validator->getValidator();
+ }
+ if (!empty($validator)){
+ $validator->setHaystack($this->getValueOptionsValues());
+ }
}
return $this;
Please sign in to comment.
Something went wrong with that request. Please try again.