|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67486 inconsistent interface for async
Submitted: 2014-06-20 09:32 UTC Modified: 2017-10-24 08:11 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: robbie86 at gmx dot de Assigned:
Status: Open Package: MySQLi related
PHP Version: 5.4.29 OS: Debian 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: robbie86 at gmx dot de
New email:
PHP Version: OS:


 [2014-06-20 09:32 UTC] robbie86 at gmx dot de
It's not possible to get the results of an async query in an user-extended mysqli_result.

For synchronous queries you could do:

class DatabaseResult extends mysqli_result {}
$r = mysqli_real_query($link, $query);
$o = new DatabaseResult($link, MYSQLI_STORE_RESULT);

For async the API is limited to mysqli_query() and mysqli_reap_async_query(). mysqli_reap_async_query() not only calls mysqlnd_reap_async_query(), but also mysql_store_result()/mysql_use_result(). Therefore the mysqli_result constructor is not usable.

Possible solutions:

1) Optional argument to mysqli_reap_async_query() to only call mysqlnd_reap_async_query() but not mysql_store_result()/mysql_use_result() - not elegant but small fix
2) mysqli_query() should save async case; mysql_store_result() & mysql_use_result() should call mysqlnd_reap_async_query() automatically; remove mysqli_reap_async_query()

Workaround now (overhead of SELECT 1 query):

$r = $link->multi_query('SELECT 1;'.$query);
// do sth. else (async)
$o = new DatabaseResult($link, MYSQLI_STORE_RESULT);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-20 13:06 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mysql
 [2014-06-20 13:06 UTC]
Valid feature request.
 [2017-10-24 08:11 UTC]
-Status: Assigned +Status: Open -Assigned To: mysql +Assigned To:
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jul 01 04:05:44 2022 UTC