Skip to content

ext/odbc: Get the exact length for quoted connection string components#21892

Merged
NattyNarwhal merged 2 commits intophp:masterfrom
NattyNarwhal:low-hanging-fruit-strlen
Apr 29, 2026
Merged

ext/odbc: Get the exact length for quoted connection string components#21892
NattyNarwhal merged 2 commits intophp:masterfrom
NattyNarwhal:low-hanging-fruit-strlen

Conversation

@NattyNarwhal
Copy link
Copy Markdown
Member

Minor optimization: strlen has to scan the string anyways. We might as well do it ourselves to look for the characters that need quoting instead of assuming the worst, and save a little bit of memory.

strlen has to scan the string until the end of the null terminator, we
might as well do the same but scan for end quotes that need escaping.
Copy link
Copy Markdown
Member

@SakiTakamachi SakiTakamachi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me :)

@NattyNarwhal NattyNarwhal merged commit 0d9ff00 into php:master Apr 29, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants