#38861 [NEW]: PDO retrive no mysql-results when using the same variable

From: Date: Sun, 17 Sep 2006 17:11:54 +0000
Subject: #38861 [NEW]: PDO retrive no mysql-results when using the same variable
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102313@lists.php.net to get a copy of this message
From:             Drezil at web dot de
Operating system: Debian/Sarge
PHP version:      5.1.6
PHP Bug Type:     PDO related
Bug description:  PDO retrive no mysql-results when using the same variable

Description:
------------
with update to php 5.1.6 i ran into problems with the pdo-mysql module
(loaded as dyn. extension in the php.ini).
If i reuse a variable after retrieving a mysql-result any following result
is empty although the query (as shown in the mysql-log) is ommited
correctly and has valid results.

switching mysql 4.1.15 to mysql 5.0.x or the oter way round doesn't fix
anything.

Reproduce code:
---------------
<?php
$user = 'xxx';
$pass = 'xxx';
try {
   $dbh = new PDO('mysql:host=localhost;dbname=xxx', $user, $pass);
   $qry = $dbh->query('SELECT 1+1')
   echo '\''.print($qry->fetch(PDO::FETCH_NUM),true).'\'<br
/>';
   $qry->closeCursor();
   $qry = $dbh->query('SELECT 1+1')
   echo '\''.print($qry->fetch(PDO::FETCH_NUM),true).'\'<br
/>';
   $qry->closeCursor();
   $qry = $dbh->query('SELECT 1+1')
   echo '\''.print($qry->fetch(PDO::FETCH_NUM),true).'\'<br
/>';
   $qry->closeCursor();
} catch (PDOException $e) {
   print "Error!: " . $e->getMessage() . "<br/>";
   die();
}
?> 

Expected result:
----------------
'2'<br />
'2'<br />
'2'<br />

Actual result:
--------------
'2'<br />
''<br />
''<br />

if i just rename the objects to $qry1, $qry2, $qry3 everything works fine
and as expected.
looks like closeCursor() deosn't work right or the objects are not
overwritten correctly.

-- 
Edit bug report at http://bugs.php.net/?id=38861&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38861&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38861&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38861&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38861&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=38861&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38861&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38861&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38861&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38861&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38861&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=38861&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=38861&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38861&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38861&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38861&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38861&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38861&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38861&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38861&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38861&r=mysqlcfg


Thread (6 messages)

« previous php.bugs (#102313) next »