Skip to content

ext/pdo: Hide DSNs in connection exception traces - #25290

Merged
iliaal merged 1 commit into
php:masterfrom
iliaal:fix/aph-pdo-dsn-sensitive-84
Nov 8, 2026
Merged

iliaal merged 1 commit into
php:masterfrom
iliaal:fix/aph-pdo-dsn-sensitive-84

Conversation

@iliaal

@iliaal iliaal commented Nov 7, 2026

Copy link
Copy Markdown
Member

A DSN can carry a password (password= for most drivers, PWD= for odbc), but only the separate $password argument of PDO::__construct() and PDO::connect() was marked #[\SensitiveParameter], so with zend.exception_ignore_args=Off a failed connect put the full DSN into the exception's trace. This marks $dsn sensitive on both methods, and the Pdo* driver subclasses inherit the redaction. Follows #23782.

A DSN may embed a password (password=... for most drivers, PWD=... for odbc),
so mark the $dsn argument of PDO::__construct() and PDO::connect() sensitive,
as $password already is. The Pdo\* driver subclasses inherit both methods and
get the same redaction.
@iliaal
iliaal merged commit 638f1e5 into php:master Nov 8, 2026
18 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.

2 participants