mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Suppress stream errors in mysqlnd
mysqlnd currently sets error_reporting=0 to suppress errors while writing to streams. Unfortunately these errors are still visible to userland error handlers, which is a source of confusion. See for example https://bugs.php.net/bug.php?id=80412. Instead add a stream flag that suppresses the emission of read/write errors in the first place, and set it in mysqlnd. I think it might be useful to have this option for userland as well in the future, but for now this is just an internal mechanism. Closes GH-6458.
This commit is contained in:
parent
a0baa09b99
commit
24a19cc232
5 changed files with 17 additions and 14 deletions
|
@ -971,7 +971,6 @@ size_t php_mysqlnd_cmd_write(MYSQLND_CONN_DATA * conn, void * _packet)
|
|||
MYSQLND_VIO * vio = conn->vio;
|
||||
MYSQLND_STATS * stats = conn->stats;
|
||||
MYSQLND_CONNECTION_STATE * connection_state = &conn->state;
|
||||
const unsigned int error_reporting = EG(error_reporting);
|
||||
size_t sent = 0;
|
||||
|
||||
DBG_ENTER("php_mysqlnd_cmd_write");
|
||||
|
@ -981,10 +980,6 @@ size_t php_mysqlnd_cmd_write(MYSQLND_CONN_DATA * conn, void * _packet)
|
|||
*/
|
||||
pfc->data->m.reset(pfc, stats, error_info);
|
||||
|
||||
if (error_reporting) {
|
||||
EG(error_reporting) = 0;
|
||||
}
|
||||
|
||||
MYSQLND_INC_CONN_STATISTIC(stats, STAT_PACKETS_SENT_CMD);
|
||||
|
||||
#ifdef MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND
|
||||
|
@ -1017,10 +1012,6 @@ size_t php_mysqlnd_cmd_write(MYSQLND_CONN_DATA * conn, void * _packet)
|
|||
}
|
||||
}
|
||||
end:
|
||||
if (error_reporting) {
|
||||
/* restore error reporting */
|
||||
EG(error_reporting) = error_reporting;
|
||||
}
|
||||
if (!sent) {
|
||||
SET_CONNECTION_STATE(connection_state, CONN_QUIT_SENT);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue