From: Ilia Alshanetsky Date: Thu, 7 Jul 2005 15:14:10 +0000 (+0000) Subject: Return an empty array rather then FALSE in fetchAll() on no results. X-Git-Tag: php-5.1.0b3~130 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86028ad122a49adfa830bc3675746c83d55d8753;p=php Return an empty array rather then FALSE in fetchAll() on no results. --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 1718dba8f6..b365c96a77 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -1293,8 +1293,7 @@ static PHP_METHOD(PDOStatement, fetchAll) } if (!do_fetch(stmt, TRUE, data, how, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC)) { FREE_ZVAL(data); - zval_dtor(return_value); - error = 1; + error = 2; } } if (!error) { @@ -1320,7 +1319,12 @@ static PHP_METHOD(PDOStatement, fetchAll) if (error) { PDO_HANDLE_STMT_ERR(); - RETURN_FALSE; + if (error != 2) { + RETURN_FALSE; + } else { /* on no results, return an empty array */ + array_init(return_value); + return; + } } } /* }}} */