Support connection keyword aliases and PDO DSN passwords - #1684
Jahnvi Thakkar (jahnvi480) wants to merge 4 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1684 +/- ##
==========================================
+ Coverage 85.86% 85.89% +0.03%
==========================================
Files 23 23
Lines 7251 7283 +32
==========================================
+ Hits 6226 6256 +30
- Misses 1025 1027 +2
🚀 New features to boost your workflow:
|
David Engel (David-Engel)
left a comment
There was a problem hiding this comment.
Summary
Reviewed commit 600020e. The alias mappings and bounded brace validation look correct. Requesting changes for the new PDO-owned password string: its lifetime is bounded, but releasing it does not securely erase its contents. See the inline finding.
Existing password handling is partial: the shared connection code explicitly zeroes the UTF-16 connection buffer, but only clears the narrow std::string. PHP core also retains the original DSN and constructor password until handle destruction and frees them without wiping. Those are pre-existing limitations, not additional blockers introduced by this PR. The SQLSRV Password alias follows the existing borrowed-string PWD path.
The documented DSN trace risk is confirmed: with zend.exception_ignore_args=0, a generated DSN password appeared in exception arguments, while the constructor password was protected by SensitiveParameterValue. Constructor credentials remain preferable.
Validation
- Built both extensions from the reviewed revision on Linux with PHP 8.4.18.
- All four no-server credential/brace PHPTs passed, with no skips.
- No additional defects found in the reviewed diff. Live SQL tests and Valgrind were not run locally.
- CI Linux and Windows passed. macOS failed before tests because Homebrew rejected the Microsoft tap as untrusted; that validation remains outstanding.
Summary
ConnectTimeout,FailoverPartner, andWorkstationIDalongsideLoginTimeout,Failover_Partner, andWSIDin both SQLSRV and PDO_SQLSRV. Reuse the existing option IDs, ODBC keywords, and connection attributes, preserving compatibility with ODBC 17 and older ODBC 18 releases.MultipleActiveResultSetsis already supported and is unchanged.Passwordas an alias forPWDin SQLSRV connection options. AddPWDandPasswordto PDO_SQLSRV DSNs. Password support is an additional PHP feature requested alongside the ODBC keyword alignment; it is not claimed as a documented ODBC 18.7 addition.SecureZeroMemory/explicit_bzerobefore release or replacement, covering parser errors, missing server, constructor override, and connection success/failure. Reuse the same secure-erasure primitive for existing token cleanup.test/tools/directory: its PHP harness, C++ before-free observer, and Bash build runner exercise 22 cases including real connection success/failure. The Linux PR job runs it; production modules contain no observer API. No new test directory is introduced.brew tapevaluates its formulae. Install both packages using fully qualified names, and require successful, nonempty listing results so partial output cannot hide installation verification failures. No global trust bypass is used.uidtosqlUserand updating all 23 references inazure-pipelines.yml. Azure otherwise exportsUID=sa, shadowing Bash's real-user-ID variable. SQL authentication values, PHP/ODBCUIDkeywords, and existing test environment names are unchanged. No elevated execution or disabled Homebrew safety checks are introduced.PWDconnection exceeded its five-second timeout under coverage while later aliases passed. The two live alias tests now allow 30 seconds (20/30 for both timeout-name orderings); they are acceptance tests, not elapsed-time assertions. No retry, failure suppression, or skip was added. Connection failures print only SQLSTATE/native error codes.Validation
MSSQL_DRIVER_NAME.get_moduleexported and runtime dependencies resolved.get_module, and absence of observer exports verified.test/tools/.e3b29086: Linux and macOS succeeded. Windows compiled successfully but failed the cold-start alias test and an existing Azure Key Vault test with0xC0000005. The latter has not reproduced locally with PHP 8.5.10, LocalDB SQL authentication, and the same coverage tool. No speculative production AKV change or skip was made.60f29456: Windows and Linux succeeded. macOS updated Homebrew to 7.0.1, then failed before driver build/tests because the inherited SQL username variable becameUID=sa.-pu: old configuration fails, renamed configuration passes. All 23 username references are present; parsed YAML is identical after reversing only the rename. All 34 Unix pipeline scripts pass Bash syntax checks. This follow-up changes onlyazure-pipelines.yml, with no new files or dependencies.Known validation limitations
zerodivcondwarning in the existing formatting implementation. The same finding reproduces on the pristine base; no suppression was added.Requested PR validation
DriverVer(sqlsrv_client_info()/PDO::ATTR_CLIENT_VERSION), without logging credentials. The locally observed ODBC 18 version was18.07.0001.Verify native PDO password erasurestep runs the relocatedtest/tools/test_pdo_password_cleanup.shlive cases; its disposable test module must not be published as a release artifact.ODBC Driver 18registration: the checked-in Azure Windows installer link currently identifies an older 18.6 release, Linux/macOS package installs are not minor-version asserted, and AppVeyor explicitly installs 17.8.1.1. This PR fixes macOS tap trust ordering and verification; it does not introduce a driver-version matrix. Verify the actual selected driver rather than relying on an environment variable that the test configuration may not use.Draft pending target-platform validation.