From e27622bbefd121735aad36f223c9fd6574037894 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Mon, 19 Mar 2018 19:59:11 -0700 Subject: [PATCH 1/2] Fixed build failure on SQL Server (sqlsrv) The regression was introduced by 2b8c40d267b4ac699ea878dcca07332e1697978c. Fixes #3060. --- lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php index 6a8be3033ea..c54faf29ed6 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php @@ -276,7 +276,7 @@ public function setFetchMode($fetchMode, ...$args) } if (isset($args[1])) { - $this->defaultFetchClassCtorArgs = (array) $args[2]; + $this->defaultFetchClassCtorArgs = (array) $args[1]; } return true; @@ -337,7 +337,7 @@ public function fetchAll($fetchMode = null, ...$args) switch ($fetchMode) { case FetchMode::CUSTOM_OBJECT: - while (($row = $this->fetch($fetchMode, $args)) !== false) { + while (($row = $this->fetch($fetchMode, ...$args)) !== false) { $rows[] = $row; } break; From ef4d96f141481a2291813f9f4dc9bd151ed206d2 Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Mon, 19 Mar 2018 22:15:10 -0700 Subject: [PATCH 2/2] Fixed build failure on SQL Server (pdo_sqlsrv) Use a wrapped PDO Statement instead of a custom class for `pdo_sqlsrv` since `PDOSqlsrv\Statement` doesn't extend `PDOStatement` anymore. --- lib/Doctrine/DBAL/Driver/PDOConnection.php | 2 +- .../DBAL/Driver/PDOSqlsrv/Connection.php | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/PDOConnection.php b/lib/Doctrine/DBAL/Driver/PDOConnection.php index 24e369065d7..770b47e0f18 100644 --- a/lib/Doctrine/DBAL/Driver/PDOConnection.php +++ b/lib/Doctrine/DBAL/Driver/PDOConnection.php @@ -111,7 +111,7 @@ public function requiresQueryForServerVersion() * @param \PDOStatement $stmt * @return PDOStatement */ - private function createStatement(\PDOStatement $stmt) : PDOStatement + protected function createStatement(\PDOStatement $stmt) : PDOStatement { return new PDOStatement($stmt); } diff --git a/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php b/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php index e7b7ed9b74e..f24067d13d4 100644 --- a/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php +++ b/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php @@ -3,6 +3,7 @@ namespace Doctrine\DBAL\Driver\PDOSqlsrv; use Doctrine\DBAL\Driver\PDOConnection; +use Doctrine\DBAL\Driver\PDOStatement; use Doctrine\DBAL\ParameterType; /** @@ -12,15 +13,6 @@ */ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection { - /** - * {@inheritdoc} - */ - public function __construct($dsn, $user = null, $password = null, array $options = null) - { - parent::__construct($dsn, $user, $password, $options); - $this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]); - } - /** * {@inheritDoc} */ @@ -50,4 +42,12 @@ public function quote($value, $type = ParameterType::STRING) return $val; } + + /** + * {@inheritDoc} + */ + protected function createStatement(\PDOStatement $stmt) : PDOStatement + { + return new Statement($stmt); + } }