Skip to content

[12.x] run prepareBindings before passing bindings to Grammar::substituteBindingsIntoRawSql #56104

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

Closed

Conversation

taka-oyama
Copy link
Contributor

@taka-oyama taka-oyama commented Jun 23, 2025

All bindings passed to Grammar::substituteBindingsIntoRawSql(...) run through Connection::prepareBindings() except for this one.

I believe this is a bug.


Examples of other places that call Grammar::substituteBindingsIntoRawSql(...)

Builder::toRawSql()

$this->toSql(), $this->connection->prepareBindings($this->getBindings())

QueryExecuted::toRawSql()

->substituteBindingsIntoRawSql($this->sql, $this->connection->prepareBindings($this->bindings));

Connection::getRawQueryLog()

'raw_query' => $this->queryGrammar->substituteBindingsIntoRawSql(
$log['query'],
$this->prepareBindings($log['bindings'])
),

@taylorotwell
Copy link
Member

Are we able to write a test to confirm a fixed behavior?

@taylorotwell taylorotwell marked this pull request as draft June 23, 2025 22:40
@taka-oyama taka-oyama marked this pull request as ready for review June 24, 2025 01:20
@taka-oyama
Copy link
Contributor Author

I've added test to assert the behavior.

@taylorotwell
Copy link
Member

I personally wonder if this was intentional to prevent logging sensitive information.

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