Skip to content

TypeConstraint: validateType fails with stringable objects. #645

Closed as not planned
@kb05

Description

@kb05

Branch: 5.2.10
File : /src/JsonSchema/Constraints/TypeConstraint.php
Line : 203

Hi.

First of all this problem seems to be solved in master but not in the published versions of packgist.

I have a situation like this:

$schema = [
    'type'                 => 'object',
    'additionalProperties' => false,
    'patternProperties'    => [
        '^.*$' => [
            'type' => 'string',
        ],
    ],
];

$params = [
    'options'   => [
        'app_oid'     => 3,
    ],
];

I have a problem when I use the validator in coerce mode, the validator doesn't cast the "app_oid" into a integer, instead gives an error, this is caused by this line:

image

In "master" branch this problem has been resolved in this way:

image

What is strange to me is that the problem was solved two years ago in the master branch, but the branch 5.2.10 it was published on 2020-05-27 (six month ago) and does not have this change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions