Bug #80837 [NEW]: Calling stmt_store_result after fetch doesn't throw an error
| From: | dharman@php.net | Date: | Fri, 05 Mar 2021 21:35:33 +0000 |
| Subject: | Bug #80837 [NEW]: Calling stmt_store_result after fetch doesn't throw an error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232586@lists.php.net to get a copy of this message | ||
From: dharman
Operating system:
PHP version: master-Git-2021-03-05 (Git)
Package: MySQLi related
Bug Type: Bug
Bug description:Calling stmt_store_result after fetch doesn't throw an error
Description:
------------
Calling stmt_store_result when in the middle of manual fetch cycle
should throw an OOS error. However, mysqlnd sets the error in conn
property which means mysqli will not throw it.
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
$statement = $mysqli->prepare("SELECT b FROM a");
$statement->execute();
$statement->bind_result($name);
$statement->fetch();
$statement->store_result();
var_dump($mysqli->error, $statement->error);
echo $statement->num_rows();
Expected result:
----------------
Fatal error: Uncaught mysqli_sql_exception: Commands out of sync; you
can't run this command now
Actual result:
--------------
string(52) "Commands out of sync; you can't run this command now"
string(0) ""
0
--
Edit bug report at https://bugs.php.net/bug.php?id=80837&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80837&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80837&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80837&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80837&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80837&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80837&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80837&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80837&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80837&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80837&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80837&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80837&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80837&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80837&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80837&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80837&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80837&r=mysqlcfg