}
net_stream->chunk_size = vio->data->options.net_read_buffer_size;
+ net_stream->flags |= PHP_STREAM_FLAG_SUPPRESS_ERRORS;
}
DBG_VOID_RETURN;
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");
*/
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
}
}
end:
- if (error_reporting) {
- /* restore error reporting */
- EG(error_reporting) = error_reporting;
- }
if (!sent) {
SET_CONNECTION_STATE(connection_state, CONN_QUIT_SENT);
}
#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 {
/* 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 {
} 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) {
}
}
- 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) {