Fix merging driver options in the pdo_sqlsrv driver test #6871
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This issue affects only the test suite and only if the
pdo_sqlsrv
connection is configured with additional DSN parameters, for instance:In this case, the
testDriverOptions()
test will fail with the following error:The reason is that the
pdo_sqlsrv
DBAL driver accepts both the DSN and PDO parameters in thedriverOptions
connection parameter:dbal/src/Driver/PDO/SQLSrv/Driver.php
Lines 36 to 40 in 54be50e
Prior to the fix, the code would merge the configuration provided by PHPUnit with the configuration provided by the test using
array_merge()
and lose the key representing the PDO attribute:array_replace()
preserves numeric keys in the case if both string string keys designated for the DSN and numeric keys designated for PDO are present.