ID: 42620 Comment by: JimmyPaterson at gmx dot de Reported By: mail at chrismandery dot de Status: Open Bug Type: PDO related Operating System: Gentoo AMD64 & Ubuntu 7.04 PHP Version: 5.2.4 New Comment:
I got the same problem on 32 bit Fedora 7 with MySQL 5.0.37 and 5.2.2. The statement is being executed properly, the return value however is always false for subsequent calls. Previous Comments: ------------------------------------------------------------------------ [2007-09-10 21:37:01] mail at chrismandery dot de Description: ------------ I am experiencing trouble with PHP using PDO with the MySQL driver. If using the same PDO statement multiple times, all calls but the first to execute() return FALSE, yet fetchAll() still returns the correct results (which may be cached from the first successful call). errorInfo() does not show any usable information. The problem happens with both PHP 5.2.4 on 64 Bit Gentoo as with PHP 5.2.1 on 32 Bit Ubuntu (7.04 aka Feisty Fawn). It is not reproducible on SLES10 or RHEL5 though (which both have no 5.2x PHP, I think). It's not a problem with PHP or PDO because it does not occur when using another database driver (i.e. SQLite). It is also not a problem with MySQL because execution the command multiple times per hand works fine. Some investigations using a network sniffer have shown that all three requests are properly sent to the server and correctly answered, so it should be a problem in the part that parses the answer from the MySQL server. Reproduce code: --------------- $db = new PDO( "mysql:host=localhost;dbname=pem", "pem", "pem" ); $q = $db->prepare( "SELECT * FROM test;" ); for ( $i = 1; $i <= 3; ++$i ) { if ( $q->execute() ) echo "success in $i\n"; else { echo "error in $i:\n"; print_r( $q->errorInfo() ); echo "\n"; } print_r( $q->fetchAll() ); echo "\n\n\n"; $q->closeCursor(); } Expected result: ---------------- success in 1 Array ( [0] => Array ( [abc] => just a [0] => just a [def] => test! [1] => test! ) ) error in 2: Array ( [0] => 00000 ) Array ( [0] => Array ( [abc] => just a [0] => just a [def] => test! [1] => test! ) ) error in 3: Array ( [0] => 00000 ) Array ( [0] => Array ( [abc] => just a [0] => just a [def] => test! [1] => test! ) ) Actual result: -------------- 3 times success instead of 1x success + 2x error. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42620&edit=1