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

[10.x] Throw exception when trying to escape array for database connection #48836

Merged

Conversation

sidneyprins
Copy link
Contributor

@sidneyprins sidneyprins commented Oct 27, 2023

When trying to escape an array value with the database connection class, typeError is thrown due to str_contains() expecting a string. Now a correct exception is thrown.

It happens for example when you try to substitute bindings into raw SQL and this part has for some reason array values in it.

Simplified version

        $queryBuilder = DB::query();
        $queryBuilder->getGrammar()->substituteBindingsIntoRawSql(
            '?', [ [ 'a', 'b'] ]
        );

@sidneyprins sidneyprins changed the title Throw error when trying to escape array [10.x] Throw error when trying to escape array Oct 27, 2023
@sidneyprins sidneyprins changed the title [10.x] Throw error when trying to escape array [10.x] Throw exception when trying to escape array Oct 27, 2023
@sidneyprins sidneyprins changed the title [10.x] Throw exception when trying to escape array [10.x] Throw exception when trying to escape array for database connection Oct 27, 2023
@sidneyprins sidneyprins marked this pull request as ready for review October 27, 2023 14:14
@taylorotwell taylorotwell merged commit 0aeecec into laravel:10.x Oct 30, 2023
20 checks passed
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