1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-22 18:02:25 +01:00

SqlsrvResult: fixed illegal false return value from sqlsrv_fetch_array() (#344)

On error, sqlsrv_fetch_array() returns false, which causes an error due to the return type declaration. This commit handles that by casting such value to null the same way other result drivers do it.
This commit is contained in:
Adam Klvač 2019-11-19 01:30:34 +01:00 committed by David Grudl
parent f2927a1b08
commit c7dee4d822

View File

@ -61,7 +61,7 @@ class SqlsrvResult implements Dibi\ResultDriver
*/
public function fetch(bool $assoc): ?array
{
return sqlsrv_fetch_array($this->resultSet, $assoc ? SQLSRV_FETCH_ASSOC : SQLSRV_FETCH_NUMERIC);
return Dibi\Helpers::false2Null(sqlsrv_fetch_array($this->resultSet, $assoc ? SQLSRV_FETCH_ASSOC : SQLSRV_FETCH_NUMERIC));
}