From: abouzekry at gmail dot com
Operating system: Windows XP SP2
PHP version: 5.2.5
PHP Bug Type: PDO related
Bug description: Cannot execute queries while other unbuffered queries are
active
Description:
------------
the same code runs on php5.2.0 without any problems, while it's
problematic with php5.2.5 i don't know why!, it insists on giving
me the following message...
Cannot execute queries while other unbuffered queries are active. Consider
using PDOStatement::fetchAll(). Alternatively, if your code is only ever
going to run against mysql, you may enable query buffering by setting the
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute
however i closed the cursor after each result fetch!!!!
Reproduce code:
---------------
if(isset($_POST['user_name'], $_POST['pass']))
{
/* check wether the user exists or not */
$result = $db->query("CALL proc_check_user('{$_POST['user_name']}',
'{$_POST['pass']}')")
or
die('0-1-Database-Query-Error-login.php:'.print_r($db->errorInfo()));
$row = $result->fetchAll(PDO::FETCH_ASSOC)
or
die('0-2-Database-Fetch-Error-login.php:'.print_r($db->errorInfo()));
/* close the DB cursor to be able to perform the other querie(s)*/
$result->closeCursor();
/* if the user doesn't exist exit prematurely! */
if($row['userExists'] == 0)
{
exit('0-2-Authentication-Error-login.php: User Doesnt Exist!');
}
/* get the user_id and full_name */
$result = $db->query("CALL proc_get_user_data('{$_POST['user_name']}',
'{$_POST['pass']}')")
or
die('0-3-Database-Query-Error-login.php:'.print_r($db->errorInfo()));
$row = $result->fetch(PDO::FETCH_ASSOC);
}
Expected result:
----------------
the machine with php5.2.0 installed when running the same code produces
a correct authentication for valid users (POSTed) and error for invalid
users.
--
Edit bug report at http://bugs.php.net/?id=44081&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=44081&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44081&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44081&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44081&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44081&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44081&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44081&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44081&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44081&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44081&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44081&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44081&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44081&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44081&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=44081&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=44081&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44081&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44081&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44081&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44081&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44081&r=mysqlcfg