Patch php56-mysqlnd-warnings.pat for PDO MySQL Bug #70583
Patch version 2015-09-25 14:56 UTC
Return to Bug #70583 |
Download this patch
Patch Revisions:
Developer: s.chernomorets@gmail.com
== reproduce ==
# cat <<EOF >t.php
<?php
set_error_handler(function($e, $m) {
echo "set_error_handler: $m; " ; var_dump($e);
}, E_ALL & ~E_STRICT);
$pdo = new PDO(
'mysql:host=localhost;port=3306',
'user',
'password'
);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$s = $pdo->query('select CONNECTION_ID()');
echo "Connection id: ".$s->fetchColumn()."\n";
try {
$pdo->query('select sleep(100)');
}catch(Exception $e) {
echo "Exception: ".$e->getmessage();
//var_dump($e);
}
EOF
# php t.php &
Connection id: 610
# mysql -h localhost -e 'kill 610'
== expected ==
Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
== actual ==
set_error_handler: PDO::query(): MySQL server has gone away; int(2)
set_error_handler: PDO::query(): Error reading result set's header; int(2)
Exception: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
diff -Naur php-5.6.13/ext/mysqlnd/mysqlnd_result.c php-5.6.13.new/ext/mysqlnd/mysqlnd_result.c
--- php-5.6.13/ext/mysqlnd/mysqlnd_result.c 2015-09-02 18:02:45.000000000 -0600
+++ php-5.6.13.new/ext/mysqlnd/mysqlnd_result.c 2015-09-25 08:05:59.000000000 -0600
@@ -491,7 +491,6 @@
SET_ERROR_AFF_ROWS(conn);
if (FAIL == (ret = PACKET_READ(rset_header, conn))) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading result set's header");
break;
}
diff -Naur php-5.6.13/ext/mysqlnd/mysqlnd_wireprotocol.c php-5.6.13.new/ext/mysqlnd/mysqlnd_wireprotocol.c
--- php-5.6.13/ext/mysqlnd/mysqlnd_wireprotocol.c 2015-09-02 18:02:45.000000000 -0600
+++ php-5.6.13.new/ext/mysqlnd/mysqlnd_wireprotocol.c 2015-09-25 08:02:07.000000000 -0600
@@ -38,7 +38,6 @@
if (FAIL == mysqlnd_read_header((conn)->net, &((packet)->header), (conn)->stats, ((conn)->error_info) TSRMLS_CC)) {\
CONN_SET_STATE(conn, CONN_QUIT_SENT); \
SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);\
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysqlnd_server_gone); \
DBG_ERR_FMT("Can't read %s's header", (packet_type_as_text)); \
DBG_RETURN(FAIL);\
}\
@@ -50,7 +50,6 @@
if (FAIL == conn->net->data->m.receive_ex((conn)->net, (buf), (packet)->header.size, (conn)->stats, ((conn)->error_info) TSRMLS_CC)) { \
CONN_SET_STATE(conn, CONN_QUIT_SENT); \
SET_CLIENT_ERROR(*conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone);\
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", mysqlnd_server_gone); \
DBG_ERR_FMT("Empty '%s' packet body", (packet_type_as_text)); \
DBG_RETURN(FAIL);\
} \
|