Bug #80837 [PATCH]: Calling stmt_store_result after fetch doesn't throw an error

From: Date: Fri, 05 Mar 2021 22:01:20 +0000
Subject: Bug #80837 [PATCH]: Calling stmt_store_result after fetch doesn't throw an error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232587@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80837&edit=1 ID: 80837 Patch added by: dharman@php.net Reported by: dharman@php.net Summary: Calling stmt_store_result after fetch doesn't throw an error Status: Open Type: Bug Package: MySQLi related PHP Version: master-Git-2021-03-05 (Git) Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Fix bug #80837 On GitHub: https://github.com/php/php-src/pull/6755 Patch: https://github.com/php/php-src/pull/6755.patch Previous Comments: ------------------------------------------------------------------------ [2021-03-05 21:35:33] dharman@php.net 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 this bug report at https://bugs.php.net/bug.php?id=80837&edit=1

« previous php.bugs (#232587) next »