andrey                                   Fri, 18 Jun 2010 17:25:41 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=300581

Log:
Fix for bug #52115      mysqli_result::fetch_all returns null, not an empty 
array

Bug: http://bugs.php.net/52115 (Open) mysqli_result::fetch_all returns null, 
not an empty array
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_fetch_all.phpt
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
    U   php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_all.phpt
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-06-18 17:05:29 UTC (rev 300580)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-06-18 17:25:41 UTC (rev 300581)
@@ -2,6 +2,8 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2010, PHP 5.3.3 RC2
 - Fixed the mail.log ini setting when no filename was given. (Johannes)
+- Fixed bug #52115 (mysqli_result::fetch_all returns null, not an empty array).
+  (Andrey)

 17 Jun 2010, PHP 5.3.3 RC1
 - Upgraded bundled sqlite to version 3.6.23.1. (Ilia)

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_fetch_all.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_fetch_all.phpt 
2010-06-18 17:05:29 UTC (rev 300580)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_fetch_all.phpt 
2010-06-18 17:25:41 UTC (rev 300581)
@@ -383,7 +383,8 @@
   }
 }
 [011]
-NULL
+array(0) {
+}
 [013]
 array(2) {
   [0]=>
@@ -402,7 +403,8 @@
   }
 }
 [016]
-NULL
+array(0) {
+}
 [017]
 array(1) {
   [0]=>

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-06-18 
17:05:29 UTC (rev 300580)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-06-18 
17:25:41 UTC (rev 300581)
@@ -1568,16 +1568,17 @@
        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))
        {

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_all.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_all.phpt    2010-06-18 
17:05:29 UTC (rev 300580)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_fetch_all.phpt    2010-06-18 
17:25:41 UTC (rev 300581)
@@ -383,7 +383,8 @@
   }
 }
 [011]
-NULL
+array(0) {
+}
 [013]
 array(2) {
   [0]=>
@@ -402,7 +403,8 @@
   }
 }
 [016]
-NULL
+array(0) {
+}
 [017]
 array(1) {
   [0]=>

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c      2010-06-18 17:05:29 UTC 
(rev 300580)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c      2010-06-18 17:25:41 UTC 
(rev 300581)
@@ -1568,16 +1568,17 @@
        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))
        {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to