php.net |  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: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dharman@php.net Assigned:
Status: Open Package: MySQLi related
PHP Version: Irrelevant OS:
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dharman@php.net
New email:
PHP Version: OS:

 

 [2021-03-06 22:25 UTC] dharman@php.net
Description:
------------
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:
---------------
<?php

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

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

Expected result:
----------------
Out of sync error

Actual result:
--------------
0

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Aug 05 13:01:24 2021 UTC