Skip to content

Use pdo quote for explain string replacment#54

Closed
jaicarlton wants to merge 2 commits into
masterfrom
use-pdo-quote-for-explain-string-replacment
Closed

Use pdo quote for explain string replacment#54
jaicarlton wants to merge 2 commits into
masterfrom
use-pdo-quote-for-explain-string-replacment

Conversation

@jaicarlton

@jaicarlton jaicarlton commented May 4, 2026

Copy link
Copy Markdown
Contributor

A claude security scan that highlighted that single quotation marks in $value break out of string literals. A legitimate use case is O'Brien.

For this solution, using$this->getConnection()->quote($value) as it will handle the correct escaping per db.

This issue is that it will change the behaviour for null values passed in. quote(null)

Before "'$value'" with $value = null would result in '' (an empty single quotes string).

With quote(null) it will return the string 'NULL' (NULL surrounded by single quotes) on Postgres and on the rest of the drives it will return ''.
To facilitate null mapping instead, a null guard is being used.

Added unit tests testing fix.

This is breaking change.

@jaicarlton jaicarlton closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant