So, I had to edit the driver itself.
I changed the file system/database/sqlsrv/sqlsrv_driver.php
The two functions _error_message()
(line 407) and _error_number()
(line 423)
In both of them, i changed the first two lines to:
$tmp = sqlsrv_errors();
if($tmp == null) return null;
$error = array_shift($tmp);
So that i.e. _error_number()
becomes:
function _error_number()
{
$tmp = sqlsrv_errors();
if($tmp == null) return null;
$error = array_shift($tmp);
return isset($error['SQLSTATE']) ? $error['SQLSTATE'] : null;
}
The error occurs since sqlsrv_errors()
returns NULL
, and when passing NULL
to the array_shift()
method, baaad things happens!