diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-30 15:06:40 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-30 15:06:40 +0100 |
commit | 39c59e084c8f5fc9b0ce379fbf62dbdf547e400b (patch) | |
tree | 76c28f69d342cfaeabcd45c329ba7ded7c2048aa /main | |
parent | a3d0752a0a44c3e51656cdba4bad8035175312f0 (diff) | |
parent | 24a19cc232668b5b839932a120d663b903729777 (diff) | |
download | php-git-39c59e084c8f5fc9b0ce379fbf62dbdf547e400b.tar.gz |
Merge branch 'PHP-8.0'
* PHP-8.0:
Suppress stream errors in mysqlnd
Diffstat (limited to 'main')
-rw-r--r-- | main/php_streams.h | 4 | ||||
-rw-r--r-- | main/streams/plain_wrapper.c | 8 | ||||
-rw-r--r-- | main/streams/xp_socket.c | 9 |
3 files changed, 16 insertions, 5 deletions
diff --git a/main/php_streams.h b/main/php_streams.h index 1bd6668607..60be0a79eb 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -181,6 +181,10 @@ struct _php_stream_wrapper { #define PHP_STREAM_FLAG_NO_FCLOSE 0x80 +/* Suppress generation of PHP warnings on stream read/write errors. + * Currently for internal use only. */ +#define PHP_STREAM_FLAG_SUPPRESS_ERRORS 0x100 + #define PHP_STREAM_FLAG_WAS_WRITTEN 0x80000000 struct _php_stream { diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 0373cc4c94..a63c225a0d 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -358,7 +358,9 @@ static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t coun /* TODO: Should this be treated as a proper error or not? */ return bytes_written; } - php_error_docref(NULL, E_NOTICE, "Write of %zu bytes failed with errno=%d %s", count, errno, strerror(errno)); + if (!(stream->flags & PHP_STREAM_FLAG_SUPPRESS_ERRORS)) { + php_error_docref(NULL, E_NOTICE, "Write of %zu bytes failed with errno=%d %s", count, errno, strerror(errno)); + } } return bytes_written; } else { @@ -426,7 +428,9 @@ static ssize_t php_stdiop_read(php_stream *stream, char *buf, size_t count) } else if (errno == EINTR) { /* TODO: Should this be treated as a proper error or not? */ } else { - php_error_docref(NULL, E_NOTICE, "Read of %zu bytes failed with errno=%d %s", count, errno, strerror(errno)); + if (!(stream->flags & PHP_STREAM_FLAG_SUPPRESS_ERRORS)) { + php_error_docref(NULL, E_NOTICE, "Read of %zu bytes failed with errno=%d %s", count, errno, strerror(errno)); + } /* TODO: Remove this special-case? */ if (errno != EBADF) { diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index cd67fcb8ca..34dc4f2037 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -104,10 +104,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) { |