|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52115 mysqli_result::fetch_all returns null, not an empty array
Submitted: 2010-06-17 23:25 UTC Modified: 2010-06-18 19:26 UTC
From: uramihsayibok at gmail dot com Assigned: mysql (profile)
Status: Closed Package: MySQLi related
PHP Version: 5.3.2 OS: Win 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: uramihsayibok at gmail dot com
New email:
PHP Version: OS:


 [2010-06-17 23:25 UTC] uramihsayibok at gmail dot com
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");

Expected result:
array(0) {

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-18 19:25 UTC]
Automatic comment from SVN on behalf of andrey
Log: Fix for bug #52115  	mysqli_result::fetch_all returns null, not an empty array
 [2010-06-18 19:26 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: mysql
 [2010-06-18 19:26 UTC]
Fix will appear in 5.3.3
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 10:01:28 2024 UTC