ID: 38001 Updated by: u...@php.net Reported By: mark-phpbugs at vectrex dot org dot uk -Status: No Feedback +Status: Closed Bug Type: PDO related Operating System: Linux PHP Version: 5.1.4 New Comment:
Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Fixed in PHP 5.3+ Previous Comments: ------------------------------------------------------------------------ [2008-07-16 22:16:31] u...@php.net Multi-query is a MySQL specific feature and the PDO API does not support it properly. Multi-query are a potential security risk as they make SQL injections easier. This is against the idea of PDO to be secure. Check this article http://blog.ulf-wendel.de/?p=192 for details . PDO_MYSQLND will fix the bug: nixn...@ulflinux:~/php53> sapi/cli/php -r '$db = new PDO("mysql:host=localhost;dbname=test", "root", "root"); $db->exec("DROP TABLE IF EXISTS test; CREATE TABLE test(id INT); INSERT INTO test(id) VALUES(1)"); $stmt = $db->query("SELECT * FROM test"); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); var_dump($db->errorInfo());' array(1) { [0]=> array(1) { ["id"]=> string(1) "1" } } array(1) { [0]=> string(5) "00000" } ------------------------------------------------------------------------ [2008-07-16 10:47:19] andrea at bhweb dot it Although nasty, I found a workaround, like the one used in mysqli to consume the resultsets: $stmt=$ppdb->prepare($query); $stmt->execute(); do { $stmt->fetch(); $stmt->closeCursor(); ++$line; } while($stmt- >nextRowset()); I found this only works using prepare and execute this way, not if you directly execute the query with query(). HTH ------------------------------------------------------------------------ [2006-07-12 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2006-07-04 22:11:48] mark-phpbugs at vetrex dot org dot uk I've tried this with the latest snapshot, php5.2-200607042030, and the problem remains. ------------------------------------------------------------------------ [2006-07-04 19:40:37] il...@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Works for me using MySQ 5.0.22 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/38001 -- Edit this bug report at http://bugs.php.net/?id=38001&edit=1