You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When client buffer is used, calling sqlsrv_fetch() with an out of bound offset will result in a fatal error. Should have caught the error gracefully. This is the repro scenario (happens in both Windows/Linux whether it's thread safe or not):
// the table has seven rows
$sql = "select upc, title, artist from cd_info order by rel_date";
$stmt = sqlsrv_query( $conn, $sql, array(), array("Scrollable"=>SQLSRV_CURSOR_CLIENT_BUFFERED));
if (! $stmt) {
echo "Query failed\n";
die (print_r(sqlsrv_errors(), true));
}
$row_count = sqlsrv_num_rows( $stmt );
echo "\nRow count for first result set = $row_count\n";
$row = sqlsrv_fetch($stmt, SQLSRV_SCROLL_LAST);
$title = sqlsrv_get_field($stmt, 1);
var_dump($title);
$row = sqlsrv_fetch($stmt, SQLSRV_SCROLL_ABSOLUTE, 3);
$title = sqlsrv_get_field($stmt, 1);
var_dump($title);
// this results in a fatal error (should have returned an error message gracefully)
$row = sqlsrv_fetch($stmt, SQLSRV_SCROLL_ABSOLUTE, 7);
$title = sqlsrv_get_field($stmt, 1);
var_dump($title);
Actual output:
Row count for first result set = 7
string(17) "Casual Viewin USA"
string(12) "Mothers Milk"
PHP Fatal error: Failed to find row 8 in the cache in ...filename.php on line 34
Fatal error: Failed to find row 8 in the cache in ...filename.php on line 34
Expected output:
Should have returned NULL / false
The text was updated successfully, but these errors were encountered:
When client buffer is used, calling sqlsrv_fetch() with an out of bound offset will result in a fatal error. Should have caught the error gracefully. This is the repro scenario (happens in both Windows/Linux whether it's thread safe or not):
Actual output:
Expected output:
Should have returned NULL / false
The text was updated successfully, but these errors were encountered: