From: ladoo at gmx dot at
Operating system: Linux (x86)
PHP version: 5.0.4
PHP Bug Type: MySQLi related
Bug description: no "out of sync"-error when preparing a statement
Description:
------------
When the result of a statement isn't freed PHP gives an error when trying
to issue a new query. It doesn't so when the new query is preparing a
statement (see reproduce code). Then mysqli::errno and mysqli::error are
empty.
workaround:
use $stmt to decide wheter $stmt = $mysqli->prepare(...) worked not
$mysqli->errno.
Reproduce code:
---------------
<?php
$my = new mysqli("localhost","user","password","db");
$stmta = $my->prepare("SELECT * FROM cms_Site");
$stmta->execute();
$stmtb = $my->prepare("SELECT * FROM cms_Site");
if ($stmtb) {
echo "prepare succeeded";
} else {
echo "prepare failed<br />";
echo "errno: ", $my->errno, " - error: ", $my->error, "<br />";
}
$x = $my->query("") or die("errno: ".$my->errno." - error:
".$my->error."<br />");
?>
Expected result:
----------------
prepare failed
errno: 2014 - error: Commands out of sync; you can't run this command now
errno: 2014 - error: Commands out of sync; you can't run this command now
Actual result:
--------------
prepare failed
errno: 0 - error:
errno: 2014 - error: Commands out of sync; you can't run this command now
--
Edit bug report at http://bugs.php.net/?id=33787&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33787&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33787&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33787&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33787&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33787&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33787&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33787&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33787&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33787&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33787&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33787&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33787&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33787&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33787&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33787&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33787&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33787&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33787&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33787&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33787&r=mysqlcfg