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.6] Add Builder::whereJsonContains() #24330

Merged
merged 1 commit into from
May 29, 2018
Merged

[5.6] Add Builder::whereJsonContains() #24330

merged 1 commit into from
May 29, 2018

Conversation

staudenmeir
Copy link
Contributor

This is a re-submit of #24258 to discuss your comment about better tests:

Asserting the SQL query matches what you expect seems pointless to test. Test that it actually does something useful / correct.

I assume that you mean integration tests? As far as I see, we don't support these for MySQL/PostgreSQL.
I agree that only testing the generated SQL isn't ideal, but I don't know how to improve it (of course, I tested the code with real databases).

For the future: Is a re-submit your preferred way to ask about a closed PR?

@taylorotwell
Copy link
Member

Isn't the string concatenation happening in compileJsonContains opening up people to SQL injection? The user can inject any string value directly into that string concatenation operation.

image

@staudenmeir
Copy link
Contributor Author

staudenmeir commented May 28, 2018

Only with raw expressions. Otherwise Grammar::whereJsonContains() uses a ? parameter.

@taylorotwell taylorotwell merged commit 52ada11 into laravel:5.6 May 29, 2018
@taylorotwell
Copy link
Member

Thanks!

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.

2 participants