Bug #74401 [Com]: PDO trigger warning already set throw exception
| From: | dws dot vad at gmail dot com | Date: | Tue, 15 Jan 2019 17:43:18 +0000 |
| Subject: | Bug #74401 [Com]: PDO trigger warning already set throw exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218964@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74401&edit=1
ID: 74401
Comment by: dws dot vad at gmail dot com
Reported by: lusc at jiedaibao dot com
Summary: PDO trigger warning already set throw exception
Status: Open
Type: Bug
Package: PDO MySQL
Operating System: Centos6.x
PHP Version: 7.0.17
Block user comment: N
Private report: N
New Comment:
7.3.1 this issue actual
Previous Comments:
------------------------------------------------------------------------
[2017-04-13 02:50:01] lusc at jiedaibao dot com
mysqlnd_result.c line 429
php_error_docref(NULL, E_WARNING, "Error reading result set's header");
mysqlnd_wireprotocol.c
line 298 and line 310
php_error_docref(NULL, E_WARNING, "%s", mysqlnd_server_gone);
------------------------------------------------------------------------
[2017-04-12 06:45:59] lusc at jiedaibao dot com
https://bugs.php.net/bug.php?id=63812 , same
problem.
------------------------------------------------------------------------
[2017-04-11 15:04:20] lusc at jiedaibao dot com
example:
```
error_reporting(E_ALL);
ini_set('display_errors', 'on');
try {
$pdo = new PDO('mysql:dbname=qiye;host=100.73.13.5;charset=utf8', 'myroot',
'Hsql1234');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt1 = $pdo->prepare('SELECT * FROM auth limit 1');
$stmt1->execute();
var_dump($stmt1->fetchAll());
sleep('30'); // stop the mysql server at this time
$stmt1 = $pdo->prepare('SELECT * FROM jdb_company_info limit 1');
$stmt1->execute();
var_dump($stmt1->fetchAll());
} catch (Throwable $e) {
var_dump($e->__toString());
}
```
output:
```
array(0) {
}
Warning: PDOStatement::execute(): MySQL server has gone away in
/mnt/g/workspace/workspace/qiye/tests/web/test.php on line 21
Warning: PDOStatement::execute(): Error reading result set's header in
/mnt/g/workspace/workspace/qiye/tests/web/test.php on line 21
string(240) "PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in
/mnt/g/workspace/workspace/qiye/tests/web/test.php:21
Stack trace:
#0 /mnt/g/workspace/workspace/qiye/tests/web/test.php(21): PDOStatement->execute()
#1 {main}"
```
------------------------------------------------------------------------
[2017-04-10 09:56:47] danack@php.net
Forgot to update the status to feedback. Also, the reason I'm asking for an example is that the
code for generating warning or exceptions looks really quite unlikely to do both.
https://github.com/php/php-src/blob/528468579b002ff17e3c38d9330da67749fd85ec/ext/pdo/pdo_dbh.c#L149-L165
------------------------------------------------------------------------
[2017-04-10 09:52:57] danack@php.net
Please can you provide a simple test script that shows this.
------------------------------------------------------------------------
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
https://bugs.php.net/bug.php?id=74401
--
Edit this bug report at https://bugs.php.net/bug.php?id=74401&edit=1