Skip to content

odbc: Quote spaces in UID/PWD appended to connection string#22791

Open
NattyNarwhal wants to merge 1 commit into
php:PHP-8.4from
NattyNarwhal:odbc-spaces-quoted-8.4
Open

odbc: Quote spaces in UID/PWD appended to connection string#22791
NattyNarwhal wants to merge 1 commit into
php:PHP-8.4from
NattyNarwhal:odbc-spaces-quoted-8.4

Conversation

@NattyNarwhal

Copy link
Copy Markdown
Member

Drivers have no standard parsing, and may react weirdly to spaces in a connection string. When we append the UID/PWD parameters for the user and pass parameters of odbc_(p)connect or the PDO constructor, add spaces to the list of characters that require quoting.

This fixes issues related to significant whitespace possibly not being parsed in a username or password, or having whitespace mangle parsing of a connection string. Note that there is no security impact because in order to do something interesting, you must be able to control the ';=' characters, and we already quote in those cases.

@NattyNarwhal
NattyNarwhal requested a review from bukka as a code owner July 17, 2026 16:45

@iliaal iliaal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Nit: maybe add a test for the space case to ext/odbc/tests/odbc_utils.phpt?

Drivers have no standard parsing, and may react weirdly to spaces in a
connection string. When we append the UID/PWD parameters for the user
and pass parameters of `odbc_(p)connect` or the PDO constructor, add
spaces to the list of characters that require quoting.

This fixes issues related to significant whitespace possibly not being
parsed in a username or password, or having whitespace mangle parsing of
a connection string. Note that there is no security impact because in
order to do something interesting, you must be able to control the ';='
characters, and we already quote in those cases.
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.

2 participants