Skip to content

Fix min/maxProperties check for invalid array input - #545

Merged
bighappyface merged 1 commit into
jsonrainbow:masterfrom
integer:min-max-properties
Nov 15, 2018
Merged

Fix min/maxProperties check for invalid array input#545
bighappyface merged 1 commit into
jsonrainbow:masterfrom
integer:min-max-properties

Conversation

@integer

@integer integer commented Nov 14, 2018

Copy link
Copy Markdown
Contributor

For invalid array input validation falls with get_object_vars() expects parameter 1 to be object, array given error.

@erayd

erayd commented Nov 14, 2018

Copy link
Copy Markdown
Contributor

@shmax Is array -> object type coercion ever a thing?

@shmax

shmax commented Nov 14, 2018

Copy link
Copy Markdown
Collaborator

Not that I know of; in any case he didn't add his code to the coercive tests. In the test he did add he's passing an array to a schema expecting an object, so it seems natural that the test should fail, but I don't know if he's trying to fix validation so it passes, or if he's fixing some kind of exception that throws instead of an expected reported error.

@erayd

erayd commented Nov 14, 2018

Copy link
Copy Markdown
Contributor

@shmax Thanks - just wanted to check that in case this code would ever be expected to count an array rather than ignoring it.

@integer Looks pretty good. Your test shouldn't include a type keyword though; it's important that it fails validation for the right reason.

@integer

integer commented Nov 14, 2018

Copy link
Copy Markdown
Contributor Author

@erayd I simplified test.

This pull request covers invalid input which our QA team tried. This input was not valid (Is is OK) but whole program stops with PHP error. With my patch validation fails and program is still running.

@erayd erayd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - thanks @integer!

@bighappyface bighappyface left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for adde6b0

@bighappyface
bighappyface merged commit f981a46 into jsonrainbow:master Nov 15, 2018
@erayd erayd mentioned this pull request Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants