Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Pass the right validator options #2293

Merged
merged 1 commit into from Sep 4, 2012
Merged

Pass the right validator options #2293

merged 1 commit into from Sep 4, 2012

Conversation

ghost
Copy link

@ghost ghost commented Sep 4, 2012

This does not give the required result. It gives the isset result which is a boolean true or false.
(isset($this->attributes['min'])) ?: 0

I used a var_dump($options) in Zend\validator\GreatherThan.php

var_dump with min value 0:
array (size=2)
'min' => boolean true
'inclusive' => boolean true

var_dump with min value 5:
array (size=2)
'min' => boolean true
'inclusive' => boolean true

This does work. It adds the value as expected.
(isset($this->attributes['min'])) ? $this->attributes['min'] : 0, 

var_dump with min value 0:
array (size=2)
'min' => int 0
'inclusive' => boolean true

var_dump with min value 5:
array (size=2)
'min' => int 5
'inclusive' => boolean true

This does not give the required result. It gives the isset result which is a boolean true or false.
(isset($this->attributes['min'])) ?: 0

This does work. It adds the value as expected.
(isset($this->attributes['min'])) ? $this->attributes['min'] : 0, 
@travisbot
Copy link

This pull request passes (merged 9a4571f into 3a4cee6).

weierophinney added a commit that referenced this pull request Sep 4, 2012
- README.md, ParameterReflection, and Version needed to be reverted to release
  branch in order to merge cleanly.
@weierophinney weierophinney merged commit 9a4571f into zendframework:master Sep 4, 2012
@weierophinney
Copy link
Member

Merged to 2.0.0, 2.0.1, and master.

fabiocarneiro pushed a commit to fabiocarneiro/zend-form that referenced this pull request Feb 4, 2015
Same issue as with zendframework/zendframework#2293

It passes the value of isset and not the min/step attribute.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants