From 5a4a66cdd5280cf7d83cec5a4aee8baf0f6d757d Mon Sep 17 00:00:00 2001 From: Andrey Hristov Date: Fri, 18 Jun 2010 17:25:41 +0000 Subject: Fix for bug #52115 mysqli_result::fetch_all returns null, not an empty array --- ext/mysqlnd/mysqlnd_result.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ext/mysqlnd') diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index 7769018d51..539cfbce2d 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -1568,16 +1568,17 @@ MYSQLND_METHOD(mysqlnd_res, fetch_all)(MYSQLND_RES * result, unsigned int flags, DBG_INF_FMT("flags=%u", flags); /* mysqlnd_res::fetch_all works with buffered resultsets only */ - if (!set || - !set->row_count || !set->data_cursor || - set->data_cursor >= set->data + set->row_count) - { + if (result->unbuf || (!result->unbuf && !set)) { RETVAL_NULL(); DBG_VOID_RETURN; - } + } mysqlnd_array_init(return_value, (unsigned int) set->row_count); + if (!set->row_count || !set->data_cursor || set->data_cursor >= set->data + set->row_count) { + DBG_VOID_RETURN; + } + while (set->data_cursor && (set->data_cursor - set->data) < (set->row_count * result->meta->field_count)) { -- cgit v1.2.1