From 7440f7ba7dc6cf6bca6267d06a3d5dc3edebc5f6 Mon Sep 17 00:00:00 2001 From: Andrey Pyzhikov <5071@mail.ru> Date: Fri, 27 May 2022 09:48:34 +0800 Subject: [PATCH 1/2] Bug: The SQLSRV driver ignores the port value from the config. Signed-off-by: Andrey Pyzhikov <5071@mail.ru> --- system/Database/SQLSRV/Connection.php | 4 ++++ user_guide_src/source/changelogs/v4.2.0.rst | 1 + 2 files changed, 5 insertions(+) diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index acbada4e6c..58bbf6f3db 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -120,6 +120,10 @@ class Connection extends BaseConnection unset($connection['UID'], $connection['PWD']); } + if (strpos($this->hostname, ',') === false) { + $this->hostname = $this->port !== '' ? "{$this->hostname}, {$this->port}" : $this->hostname; + } + sqlsrv_configure('WarningsReturnAsErrors', 0); $this->connID = sqlsrv_connect($this->hostname, $connection); diff --git a/user_guide_src/source/changelogs/v4.2.0.rst b/user_guide_src/source/changelogs/v4.2.0.rst index 8a28083975..55a5e6b973 100644 --- a/user_guide_src/source/changelogs/v4.2.0.rst +++ b/user_guide_src/source/changelogs/v4.2.0.rst @@ -119,5 +119,6 @@ Deprecations Bugs Fixed ********** +- The SQLSRV driver ignores the port value from the config. See the repo's `CHANGELOG.md `_ for a complete list of bugs fixed. From a6d9eefa003935e5070045d074062b0d0c8178ac Mon Sep 17 00:00:00 2001 From: Andrey Pyzhikov <5071@mail.ru> Date: Fri, 27 May 2022 12:38:38 +0800 Subject: [PATCH 2/2] Condition changed Signed-off-by: Andrey Pyzhikov <5071@mail.ru> --- system/Database/SQLSRV/Connection.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php index 58bbf6f3db..f180ca4f6b 100755 --- a/system/Database/SQLSRV/Connection.php +++ b/system/Database/SQLSRV/Connection.php @@ -120,8 +120,8 @@ class Connection extends BaseConnection unset($connection['UID'], $connection['PWD']); } - if (strpos($this->hostname, ',') === false) { - $this->hostname = $this->port !== '' ? "{$this->hostname}, {$this->port}" : $this->hostname; + if (strpos($this->hostname, ',') === false && $this->port !== '') { + $this->hostname .= ', ' . $this->port; } sqlsrv_configure('WarningsReturnAsErrors', 0);