Bug #81286 [Opn->Ver]: PDO return phantom rowset and no error when MYSQL_ATTR_USE_BUFFERED_QUERY=FALSE

From: Date: Sat, 24 Jul 2021 20:13:54 +0000
Subject: Bug #81286 [Opn->Ver]: PDO return phantom rowset and no error when MYSQL_ATTR_USE_BUFFERED_QUERY=FALSE
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235317@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81286&edit=1 ID: 81286 Updated by: dharman@php.net Reported by: tropicano at ukr dot net Summary: PDO return phantom rowset and no error when MYSQL_ATTR_USE_BUFFERED_QUERY=FALSE -Status: Open +Status: Verified Type: Bug Package: PDO MySQL Operating System: All PHP Version: 7.4.21 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2021-07-24 20:13:35] dharman@php.net Thanks for reporting this issue. This has already been fixed in PHP 8.0.1 but the fix was not backported to PHP 7. It might be possible to backport it... FYI, your expected result doesn't match what really should happen. The proper output with SILENT mode enabled should be: Array ( [0] => 00000 [1] => [2] => ) Array ( [0] => 00000 [1] => [2] => ) Array ( [0] => 21000 [1] => 1242 [2] => Subquery returns more than 1 row ) ------------------------------------------------------------------------ [2021-07-24 12:30:27] tropicano at ukr dot net Description: ------------ Unexpected phantom rowset and no error when PDO::MYSQL_ATTR_USE_BUFFERED_QUERY = FALSE. When PDO::MYSQL_ATTR_USE_BUFFERED_QUERY = TRUE then result expected. Test script: --------------- $db = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass, [PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => FALSE]); $qr = $db->query('SELECT IF(1, (SELECT 1 UNION ALL SELECT 2), 0)'); print_r($db->errorInfo()); // here is no error if ($qr) { print_r($qr->errorInfo()); // here is no error too $qr->nextRowset(); // return false; print_r($qr->errorInfo()); // here is no error again } Expected result: ---------------- Array ( [0] => 21000 [1] => 1242 [2] => Subquery returns more than 1 row ) Actual result: -------------- Array ( [0] => 00000 [1] => [2] => ) Array ( [0] => 00000 [1] => [2] => ) Array ( [0] => 00000 [1] => [2] => ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81286&edit=1

« previous php.bugs (#235317) next »