Skip to content

Commit 8fbba76

Browse files
Set WarningsReturnAsErrors = 0 before connection (#4762)
* Set WarningsReturnAsErrors = 0 before connection If there is a warning establishing the connection, it will treat it as an error and Codeigniter will throw an exception. It should be configured prior the first sql command. * Removed extra whitespace
1 parent 6a2d5d6 commit 8fbba76

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

system/Database/SQLSRV/Connection.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,11 @@ public function connect(bool $persistent = false)
129129
unset($connection['UID'], $connection['PWD']);
130130
}
131131

132+
sqlsrv_configure('WarningsReturnAsErrors', 0);
132133
$this->connID = sqlsrv_connect($this->hostname, $connection);
133134

134135
if ($this->connID !== false)
135136
{
136-
sqlsrv_configure('WarningsReturnAsErrors', 0);
137-
138137
// Determine how identifiers are escaped
139138
$query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
140139
$query = $query->getResultObject();

0 commit comments

Comments
 (0)