Skip to content

Type Checking integers is too loose. #33

Closed
@wjaspers

Description

@wjaspers

If my schema is defined as such:
Source of issue appears to be this commit: 97ec369

{
  "type": "object",
  "properties": {
      "value": {
          "type": "integer"
          "title": "Value",
          "required": true
      }
  }
}

And my data is as follows, note that "value" is a string:

{
   "value": "32"
}

Result is valid, but expected failure.
The value should explicitly be an integer.

The problem is integer comparisons in Type.php are:

...
if ('integer' === $type) {
   return is_int($value) || ctype_digit($value);
}
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions