|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32973 Problem with unbuffered prep. statements
Submitted: 2005-05-07 08:51 UTC Modified: 2005-05-10 00:10 UTC
From: Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5CVS-2005-05-07 (dev) OS: Linux
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 !
Your email address:
Solve the problem:
44 - 7 = ?
Subscribe to this entry?

 [2005-05-07 08:51 UTC]
Prepare does not clean the wire before the next prepare. It should be discussed whether it should be done but this bug is created to have a track of this issue.

Reproduce code:

$st = $db->prepare("SELECT 1 AS test");

$st = $db->prepare("SELECT 1.23 AS test");


Expected result:
object(mysqli_stmt)#3 (0) {
string(4) "1.23"

Actual result:
PHP Fatal error:  Call to a member function execute() on a non-object in /home/andrey/tst/ttt.php on line 11


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-08 15:01 UTC]
It makes no sense to do some magic and closing unbuffered statements when executing mysql_prepare.

$stmt1 = $mysql->prepare("SELECT foo FROM bar");

$stmt2->prepare("SELECT foo FROM user");

So why should 2nd prepare automatically clean resultset from  first statement instead of giving an error ??

It's well documented that you have to either store the resultset or to close the statement before executing any other command (execept you're using cursors with MySQL 5.0).

The same is also true when executing unbuffered queries in ext/mysql and ext/mysqli.
 [2005-05-10 00:10 UTC]
added code that emits an warning in case of there is still error on the wire. ext/mysqli does it for unbuffered queries.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Jan 22 12:03:42 2022 UTC