Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.5] Fix PHP error in operatorForWhere collection method. #20913

Merged
merged 1 commit into from
Sep 1, 2017

Conversation

mathieutu
Copy link
Contributor

Hi,
When you compare thing in collection (contains, every and where), if arguments are not comparable, php will throw an error.

Example:

collect([['v' => 1], ['v' => new stdClass]])->where('v', 1);

screen shot 2017-09-01 at 11 55 11

This PR fix that, and add some tests to check it.

@themsaid themsaid changed the title Fix PHP error in operatorForWhere collection method. [5.5] Fix PHP error in operatorForWhere collection method. Sep 1, 2017
@taylorotwell taylorotwell merged commit 7166315 into laravel:5.5 Sep 1, 2017
@mathieutu mathieutu deleted the fix/5.5/where-collection branch September 1, 2017 16:50
@GrahamCampbell
Copy link
Member

Have you tested this works?

@mathieutu
Copy link
Contributor Author

@GrahamCampbell I did, and I even wrote an unit test for that.
The test will fail if you remove the try/catch.
😉

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.

3 participants