EllisLab/CodeIgniter — Issue #611: sqlsrv_driver.php _error_number(): error when there are no errors
Author: danieleorler
Created: 2011-10-24 09:43:16+00:00
State: open

When you call _error_number() when the query is ok (has no errors) you get:

array_shift() [function.array-shift]: The argument should be an array

This is because of we are trying to get the first element of an empty array, thus I suggest to test that the array is not empty before trying to get its first element, turning from (line 436):

$error = array_shift(sqlsrv_errors());

to

$errors = sqlsrv_errors();
if(count($errors))
$error = array_shift($errors);