Req #80842 [NEW]: Reading num_rows property on unbuffered result should throw an error
| From: | dharman@php.net | Date: | Sat, 06 Mar 2021 22:25:34 +0000 |
| Subject: | Req #80842 [NEW]: Reading num_rows property on unbuffered result should throw an error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232597@lists.php.net to get a copy of this message | ||
From: dharman
Operating system:
PHP version: Irrelevant
Package: MySQLi related
Bug Type: Feature/Change Request
Bug description:Reading num_rows property on unbuffered result should throw an error
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
--
Edit bug report at https://bugs.php.net/bug.php?id=80842&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80842&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80842&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80842&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80842&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80842&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80842&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80842&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80842&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80842&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80842&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80842&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80842&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80842&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80842&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80842&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80842&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80842&r=mysqlcfg