Bug #77716 [NEW]: PDO show warning event the PDO::ERRMODE_EXCEPTION has been set
| From: | shyandsy at gmail dot com | Date: | Sat, 09 Mar 2019 17:32:09 +0000 |
| Subject: | Bug #77716 [NEW]: PDO show warning event the PDO::ERRMODE_EXCEPTION has been set | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-219896@lists.php.net to get a copy of this message | ||
From: shyandsy at gmail dot com
Operating system: CentOS 7.3.1611
PHP version: 7.2.16
Package: PDO Core
Bug Type: Bug
Bug description:PDO show warning event the PDO::ERRMODE_EXCEPTION has been set
Description:
------------
The PDO shows warning event I have set the error mode to exception
Test script:
---------------
<?php
define(DB_HOSTNAME, "");
define(DB_PORT, "");
define(DB_DATABASE, "");
define(DB_USERNAME, "");
define(DB_PASSWORD, "");
echo DB_HOSTNAME . "\n";
try{
$dsn = "mysql:host=" . DB_HOSTNAME. ";port=" . DB_PORT .
";dbname="
. DB_DATABASE;
$pdo = new PDO($dsn,DB_USERNAME,DB_PASSWORD, [
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);
$pdo->query("SET wait_timeout=1;");
sleep(3);
$pdo->query("select * from dev_user");
}catch(\PDOException $e){
echo $e->getMessage() . "<br>";
}
Expected result:
----------------
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
Actual result:
--------------
[root@localhost experiment]# php MysqlGoneAway.php
192.168.216.133
PHP Warning: PDO::query(): MySQL server has gone away in
/home/wwwroot/www.xxx.com/experiment/MysqlGoneAway.php on line 21
PHP Warning: PDO::query(): Error reading result set's header in
/home/wwwroot/www.xxx.com/experiment/MysqlGoneAway.php on line 21
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
--
Edit bug report at https://bugs.php.net/bug.php?id=77716&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77716&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77716&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77716&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77716&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77716&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77716&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77716&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77716&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77716&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77716&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77716&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77716&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77716&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77716&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77716&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77716&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77716&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77716&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77716&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77716&r=mysqlcfg