Cast $step to float in \Zend\Validator\Step #3164

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@alexdenvir
Contributor

When creating a Number element on a form, setting a step attribute of 0.01 (for example, to accept a currency value) adds a Step validator to its validators.

If the number element is created with a string for the step attribute , eg: '0.01', instead of a float, this value is set as a string in the validator.

The is valid function uses strict comparisons between the float value returned by fmod and the step value, and naturally 0.01 !== '0.01'.

This pull request simply casts the value of step to float in the setStep function.

@weierophinney weierophinney added a commit that referenced this pull request Dec 11, 2012
@weierophinney weierophinney Merge branch 'hotfix/3164' into develop
Forward port #3164
5c27e8e
@weierophinney weierophinney added a commit that closed this pull request Dec 11, 2012
@weierophinney weierophinney Merge branch 'hotfix/3164'
Close #3164
f55af9b
@weierophinney weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/3164' 7674ec8
@weierophinney weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/3164' into develop ab8eeac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment