Bug #80827 [NEW]: SHOW WARNINGS fails when using native prepared statements
| From: | john@php.net | Date: | Wed, 03 Mar 2021 23:13:59 +0000 |
| Subject: | Bug #80827 [NEW]: SHOW WARNINGS fails when using native prepared statements | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232524@lists.php.net to get a copy of this message | ||
From: john
Operating system: Ubuntu Focal
PHP version: 7.3.27
Package: PDO MySQL
Bug Type: Bug
Bug description:SHOW WARNINGS fails when using native prepared statements
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 bug report at https://bugs.php.net/bug.php?id=80827&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80827&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80827&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80827&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80827&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80827&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80827&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80827&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80827&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80827&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80827&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80827&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80827&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80827&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80827&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80827&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80827&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80827&r=mysqlcfg