Bug #80827 [Asn->Fbk]: SHOW WARNINGS fails when using native prepared statements

From: Date: Fri, 05 Mar 2021 08:35:27 +0000
Subject: Bug #80827 [Asn->Fbk]: SHOW WARNINGS fails when using native prepared statements
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232570@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80827&edit=1 ID: 80827 Updated by: nikic@php.net Reported by: john@php.net Summary: SHOW WARNINGS fails when using native prepared statements -Status: Assigned +Status: Feedback Type: Bug Package: PDO MySQL Operating System: Ubuntu Focal PHP Version: 7.4.3 Assigned To: john Block user comment: N Private report: N New Comment: I believe that https://github.com/php/php-src/commit/f3d5877845358d011174cf87283b456cee6f7f53 already fixed this issue a while ago, you're just using a very old PHP 7.4 version. Previous Comments: ------------------------------------------------------------------------ [2021-03-03 23:13:59] john@php.net Description: ------------ There is a bug in the pdo_mysql driver with PDO::ATTR_EMULATE_PREPARES set to false that prevents a query such as SHOW WARNINGS from working properly. I'm intending on writing a patch to fix this issue once I dig into it further, but I wanted to get the bug report live in case anyone else runs into this issue in the wild (e.g. Laravel disables emulated prepares for their DB implementation on top of PDO). Test script: --------------- <?php $db = new \PDO(...$params); $db->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false); $result = $db->query('SHOW WARNINGS')->fetchAll(); // causes a 2014 client error $db = new \PDO(...$params); $db->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); $result = $db->query('SHOW WARNINGS')->fetchAll(); // works ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80827&edit=1

« previous php.bugs (#232570) next »