Problem/Motivation
The way I understand it, StatementWrapperLegacyTest::testClientStatementMethod()
is written to ensure that PDOStatement methods can run against $this->statement regardless of what the actual object is. The choice of the query that is executed, the choice of the method, and the actual result is arbitrary and not important, just that there is no exception thrown. The SQL Server driver will occasionally add extra columns to a database table, for example, if a column is labeled unique but is too many bytes in size for SQLServer to index against. Using Select * From {test} returns a different number of columns because of this, but the method does exist and does not error, which is what the test is trying to actually assert.
Steps to reproduce
Run the test using the Sqlsrv driver.
Proposed resolution
The query could be changed to anything. The choice of method could be changed as well. I propose changing the query to `SELECT id from {test}` and asserting that the column count is 1.
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
None
Issue fork drupal-3213644
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
beakerboysqlite failures appear to be unrelated.
Comment #4
mondrakeI see the same sqlite failure on php 8.1 at #3217699: Convert select query extenders to backend-overrideable services, good to know it’s unrelated
Comment #5
beakerboyComment #6
daffie commented+1 for RTBC. I have run the test with the MR on my local machine with SQL Server and it passes all but the test StatementWrapperLegacyTest::testMissingMethod(). To pass that test we need to change the code for the method Drupal\Core\Database\StatementWrapper::__call() to:
This is needed because the code
is_callable([$this->getClientStatement(), $method])will trigger a PDOException on the SQL Server.Comment #7
beakerboy@daffie Microsoft PDO throwing an exception is a bug, and is fixed in pdo_sqlsrv_5.10beta1.
Comment #8
daffie commented@Beakerboy: Thank you for the info!
Comment #9
alexpottCommitted and pushed 8512e0e93c to 9.4.x and 9d6d526458 to 9.3.x. Thanks!
Backported to 9.3.x as a test only fix.