From 2e9a2627cfbdc32f1bad1279a2d93652510933d9 Mon Sep 17 00:00:00 2001 From: Nicolas PAJON Date: Wed, 31 Oct 2018 10:20:58 +0100 Subject: [PATCH 1/2] Update Driver.php Adding Windows Authentication compatibility according to http://php.net/manual/en/function.sqlsrv-connect.php "By default, the connection is attempted using Windows Authentication. To connect using SQL Server Authentication, include "UID" and "PWD" in the connection options array." --- lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php b/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php index 2b84a0fcf81..5b4871b4484 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php @@ -31,8 +31,13 @@ public function connect(array $params, $username = null, $password = null, array $driverOptions['CharacterSet'] = $params['charset']; } - $driverOptions['UID'] = $username; - $driverOptions['PWD'] = $password; + if ($username !== null) { + $driverOptions['UID'] = $username; + } + + if ($password !== null) { + $driverOptions['PWD'] = $password; + } if (! isset($driverOptions['ReturnDatesAsStrings'])) { $driverOptions['ReturnDatesAsStrings'] = 1; From 7cd248c3740b8321e0cce4533ff7d90af8a009a6 Mon Sep 17 00:00:00 2001 From: Nicolas PAJON Date: Wed, 31 Oct 2018 11:30:06 +0100 Subject: [PATCH 2/2] Update Driver.php fix code style --- lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php b/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php index 5b4871b4484..a9be26e9dea 100644 --- a/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php +++ b/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php @@ -34,7 +34,7 @@ public function connect(array $params, $username = null, $password = null, array if ($username !== null) { $driverOptions['UID'] = $username; } - + if ($password !== null) { $driverOptions['PWD'] = $password; }