Permalink
Browse files

Fix integer check

If we use "type": "integer", and property is boolean we got an error result (true).
Must be false, because boolean values (true/false) is not a integer.

UPD: Take into account the integer in string.
  • Loading branch information...
1 parent 0ba1d4e commit 97ec36940da54d736304bf0eb34135d283305a57 @bayandin bayandin committed Nov 2, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/JsonSchema/Constraints/Type.php
@@ -78,7 +78,7 @@ protected function validateType($value, $type)
}
if ('integer' === $type) {
- return (integer) $value == $value ? true : is_int($value);
+ return is_int($value) || ctype_digit($value);
@wjaspers

wjaspers Mar 13, 2013

ctype_digit will allow false positives on strict type checks

}
if ('number' === $type) {

0 comments on commit 97ec369

Please sign in to comment.