|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80842 Reading num_rows property on unbuffered result should throw an error
Submitted: 2021-03-06 22:25 UTC Modified: -
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Assigned:
Status: Open Package: MySQLi related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
12 + 43 = ?
Subscribe to this entry?

 [2021-03-06 22:25 UTC]
Reading mysqli_stmt::num_rows property or calling the method mysqli_stmt::num_rows() should throw an error if using unbuffered results and the result hasn't been fully fetched yet. 

Test script:

$mysqli = new mysqli('localhost', 'user', 'password', 'test');
$mysqli->set_charset('utf8mb4'); // always set the charset

$stmt = $mysqli->prepare('SELECT * FROM a LIMIT 2');
echo $stmt->num_rows; // <-- Should trigger OOS error

Expected result:
Out of sync error

Actual result:


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Feb 27 01:01:28 2024 UTC