From 24a19cc232668b5b839932a120d663b903729777 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 26 Nov 2020 12:30:17 +0100 Subject: 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. --- main/streams/xp_socket.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'main/streams/xp_socket.c') diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index f3370e89f7..a369bf5ff2 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -103,10 +103,13 @@ retry: } } - estr = php_socket_strerror(err, NULL, 0); - php_error_docref(NULL, E_NOTICE, "Send of " ZEND_LONG_FMT " bytes failed with errno=%d %s", + if (!(stream->flags & PHP_STREAM_FLAG_SUPPRESS_ERRORS)) { + estr = php_socket_strerror(err, NULL, 0); + php_error_docref(NULL, E_NOTICE, + "Send of " ZEND_LONG_FMT " bytes failed with errno=%d %s", (zend_long)count, err, estr); - efree(estr); + efree(estr); + } } if (didwrite > 0) { -- cgit v1.2.1