From: Frank M. Kromann Date: Tue, 20 Mar 2001 20:25:55 +0000 (+0000) Subject: Fixing crash when result conrains 0 rows X-Git-Tag: php-4.0.6RC1~631 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80c4511012272fcb9df53251424766435131521e;p=php Fixing crash when result conrains 0 rows --- diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c index 8caa1edc1e..6d3775c0d8 100644 --- a/ext/fbsql/php_fbsql.c +++ b/ext/fbsql/php_fbsql.c @@ -2555,6 +2555,9 @@ PHP_FUNCTION(fbsql_fetch_row) if (result->fetchHandle == NULL) { RETURN_FALSE; } + if (result->rowCount == 0) { + RETURN_FALSE; + } if (result->rowCount == 0x7fffffff) { if (!phpfbFetchRow(result,rowIndex)) { RETURN_FALSE; @@ -2627,9 +2630,14 @@ PHP_FUNCTION(fbsql_fetch_array) { RETURN_FALSE; } + if (result->rowCount == 0) { + RETURN_FALSE; + } if (result->rowCount == 0x7fffffff) { - phpfbFetchRow(result,result->rowIndex); + if (!phpfbFetchRow(result,result->rowIndex)) { + RETURN_FALSE; + } } row = fbcrhRowAtIndex(result->rowHandler,rowIndex); if (row == NULL)