From:             
Operating system: Win 7
PHP version:      5.3.2
Package:          MySQLi related
Bug Type:         Bug
Bug description:mysqli_result::fetch_all returns null, not an empty array

Description:
------------
The documentation says that mysqli_result::fetch_all

- "fetches all result rows and returns the result set as an associative
array, a numeric array, or both"

- "Returns an array of associative or numeric arrays holding result rows"

(though the return type is "mixed").



As far as I can tell, fetch_all returns NULL when there are no rows (ie,
->num_rows==0).





Filed as a bug and not a documentation problem because it'd be nice to
always get an array back.

Test script:
---------------
// Requires that mysqlnd be loaded, of course



// $mysqli = new mysqli(...)

$result = $mysqli->query("SELECT 1 LIMIT 0");

var_dump($result->fetch_all());

Expected result:
----------------
array(0) {

}

Actual result:
--------------
NULL

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52115&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52115&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52115&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52115&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52115&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52115&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52115&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52115&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52115&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52115&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52115&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52115&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52115&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52115&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52115&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52115&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52115&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52115&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52115&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52115&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52115&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52115&r=mysqlcfg

Reply via email to