Skip to content

Commit

Permalink
SqlsrvResult: fixed illegal false return value from sqlsrv_fetch_arra…
Browse files Browse the repository at this point in the history
…y() (#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.
  • Loading branch information
adawolfa authored and dg committed Nov 19, 2019
1 parent f2927a1 commit c7dee4d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Dibi/Drivers/SqlsrvResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getRowCount(): int
*/
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));
}


Expand Down

0 comments on commit c7dee4d

Please sign in to comment.