Skip to content

Conversation

@integer
Copy link
Contributor

@integer integer commented Nov 14, 2018

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

@erayd
Copy link
Contributor

erayd commented Nov 14, 2018

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

@shmax
Copy link
Collaborator

shmax commented Nov 14, 2018

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
Copy link
Contributor

erayd commented Nov 14, 2018

@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
Copy link
Contributor Author

integer commented Nov 14, 2018

@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.

Copy link
Contributor

@erayd erayd left a comment

Choose a reason for hiding this comment

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

Looks good - thanks @integer!

Copy link
Collaborator

@bighappyface bighappyface left a comment

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