Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.9.7
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Validate
-
Labels:None
Description
"The integers are formed by the natural numbers including 0 (0, 1, 2, 3, ...) together with the negatives of the non-zero natural numbers (−1, −2, −3, ...). Viewed as subset of the real numbers, they are numbers that can be written without a fractional or decimal component, and fall within the set {... −2, −1, 0, 1, 2, ...}. For example, 65, 7, and −756 are integers; 1.6 and 1½ are not integers."
http://en.wikipedia.org/wiki/Integer
Basically its just a naming issue but in some cases it can lead to confusion why floats are accepted by Zend_Validate_Int as an int does consist only of natural numbers. Maybe there is a special reason or i am confusing something big time?, but a more logic name would be Zend_Validate_Number.
require_once 'Zend/Validate/Int.php
$foo = new Zend_Validate_Int();
zend_debug::dump($foo->isValid(1));
zend_debug::dump($foo->isValid(1.2));
zend_debug::dump($foo->isValid('1,2'));
Using your example on latest release I get:
1. true
2. false
3. false
In my eyes this is correct behaviour. I see no problems.