ID:               38861
 User updated by:  Drezil at web dot de
 Reported By:      Drezil at web dot de
-Status:           Bogus
+Status:           Open
 Bug Type:         PDO related
 Operating System: Debian/Sarge
 PHP Version:      5.1.6
 Assigned To:      wez
 New Comment:

This is definitely a bug in PDO. I tried unset($qry);, a "$qry = null;"
and so on and so forth.
the exact same code actually works in my other enviroment (WinXP, IIS5,
PHP 5.0.7, Mysql 4.1.15). I also un-/reinstall php on the debian
system.

To get it even more confusing i got such constructs in other scripts,
which work as the should.
as shown in the mysql-log the prepare and the execute is omitted
correctly. even $qry->rowCount(); echos '1'.. but still $qry->fetch()
returns false.

by the way: a buffered-query problem in not solved by just renaming the
var's (because if an unbuffered qry is sent, it must be closed
explicitly before reusing the same connection. this does't depend on
the var-name in php). This would just raise an error during script
execution (which is printed to me due to an error-level of E_ALL |
E_STRICT).

my script is quite complex, so i reduced the example to the minimum. A
more detailed view on the source-code can be fond at:
http://vserver.mission-unknown.de/stuff/code.phps

if this is no bug, WHY does the EXACT SAME script behave completely
different on both systems? The differences in the php.ini are only
system-specific due to win/unix reasons so there is no
"misconfigured"-excuse.

Sorry to cause you so much trouble.. ;)


Previous Comments:
------------------------------------------------------------------------

[2006-09-19 16:49:49] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You either need to enable buffered queries or disabled native 
prepare for this to work. Or replace closeCursor() with unset
($qry).

The issue is actually a MySQL limitation with buffered 
queries.

------------------------------------------------------------------------

[2006-09-17 17:11:54] Drezil at web dot de

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 this bug report at http://bugs.php.net/?id=38861&edit=1

Reply via email to