summaryrefslogtreecommitdiffstats
path: root/2707.patch
diff options
context:
space:
mode:
Diffstat (limited to '2707.patch')
-rw-r--r--2707.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/2707.patch b/2707.patch
new file mode 100644
index 0000000..4614be2
--- /dev/null
+++ b/2707.patch
@@ -0,0 +1,145 @@
+From b7514a7615b01aa20e0be73f7e13655a68fd61ea Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 23 Jul 2019 14:37:46 +0200
+Subject: [PATCH] fix for stream changes in 7.4.0beta1
+
+---
+ swoole_runtime.cc | 17 +++++++++++++++++
+ thirdparty/php/streams/plain_wrapper.c | 21 +++++++++++++++++++++
+ 2 files changed, 38 insertions(+)
+
+diff --git a/swoole_runtime.cc b/swoole_runtime.cc
+index eb6664a61..dc0fb9ad3 100644
+--- a/swoole_runtime.cc
++++ b/swoole_runtime.cc
+@@ -38,8 +38,13 @@ static PHP_FUNCTION(swoole_user_func_handler);
+ }
+
+ static int socket_set_option(php_stream *stream, int option, int value, void *ptrparam);
++#if PHP_VERSION_ID < 70400
+ static size_t socket_read(php_stream *stream, char *buf, size_t count);
+ static size_t socket_write(php_stream *stream, const char *buf, size_t count);
++#else
++static ssize_t socket_read(php_stream *stream, char *buf, size_t count);
++static ssize_t socket_write(php_stream *stream, const char *buf, size_t count);
++#endif
+ static int socket_flush(php_stream *stream);
+ static int socket_close(php_stream *stream, int close_handle);
+ static int socket_stat(php_stream *stream, php_stream_statbuf *ssb);
+@@ -259,7 +264,11 @@ static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *po
+ return host;
+ }
+
++#if PHP_VERSION_ID < 70400
+ static size_t socket_write(php_stream *stream, const char *buf, size_t count)
++#else
++static ssize_t socket_write(php_stream *stream, const char *buf, size_t count)
++#endif
+ {
+ php_swoole_netstream_data_t *abstract = (php_swoole_netstream_data_t *) stream->abstract;
+ if (UNEXPECTED(!abstract))
+@@ -277,15 +286,21 @@ static size_t socket_write(php_stream *stream, const char *buf, size_t count)
+ {
+ php_stream_notify_progress_increment(PHP_STREAM_CONTEXT(stream), didwrite, 0);
+ }
++#if PHP_VERSION_ID < 70400
+ if (didwrite < 0)
+ {
+ didwrite = 0;
+ }
++#endif
+
+ return didwrite;
+ }
+
++#if PHP_VERSION_ID < 70400
+ static size_t socket_read(php_stream *stream, char *buf, size_t count)
++#else
++static ssize_t socket_read(php_stream *stream, char *buf, size_t count)
++#endif
+ {
+ php_swoole_netstream_data_t *abstract = (php_swoole_netstream_data_t *) stream->abstract;
+ if (UNEXPECTED(!abstract))
+@@ -309,10 +324,12 @@ static size_t socket_read(php_stream *stream, char *buf, size_t count)
+ php_stream_notify_progress_increment(PHP_STREAM_CONTEXT(stream), nr_bytes, 0);
+ }
+
++#if PHP_VERSION_ID < 70400
+ if (nr_bytes < 0)
+ {
+ nr_bytes = 0;
+ }
++#endif
+
+ return nr_bytes;
+ }
+diff --git a/thirdparty/php/streams/plain_wrapper.c b/thirdparty/php/streams/plain_wrapper.c
+index f4ad4ed9b..6751b6212 100644
+--- a/thirdparty/php/streams/plain_wrapper.c
++++ b/thirdparty/php/streams/plain_wrapper.c
+@@ -59,8 +59,13 @@ extern int php_get_gid_by_name(const char *name, gid_t *gid);
+ # define PLAIN_WRAP_BUF_SIZE(st) (st)
+ #endif
+
++#if PHP_VERSION_ID < 70400
+ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count);
+ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count);
++#else
++static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t count);
++static ssize_t php_stdiop_read(php_stream *stream, char *buf, size_t count);
++#endif
+ static int sw_php_stdiop_close(php_stream *stream, int close_handle);
+ static int php_stdiop_stat(php_stream *stream, php_stream_statbuf *ssb);
+ static int php_stdiop_flush(php_stream *stream);
+@@ -216,7 +221,11 @@ static php_stream *_sw_php_stream_fopen_from_fd_int(int fd, const char *mode, co
+ return php_stream_alloc_rel(&sw_php_stream_stdio_ops, self, persistent_id, mode);
+ }
+
++#if PHP_VERSION_ID < 70400
+ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count)
++#else
++static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t count)
++#endif
+ {
+ php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
+
+@@ -225,11 +234,15 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count
+ if (data->fd >= 0)
+ {
+ int bytes_written = write(data->fd, buf, count);
++#if PHP_VERSION_ID < 70400
+ if (bytes_written < 0)
+ {
+ return 0;
+ }
+ return (size_t) bytes_written;
++#else
++ return bytes_written;
++#endif
+ }
+ else
+ {
+@@ -237,7 +250,11 @@ static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count
+ }
+ }
+
++#if PHP_VERSION_ID < 70400
+ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
++#else
++static ssize_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
++#endif
+ {
+ php_stdio_stream_data *data = (php_stdio_stream_data*) stream->abstract;
+ size_t ret;
+@@ -737,7 +754,11 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
+ /* }}} */
+
+ /* {{{ plain files opendir/readdir implementation */
++#if PHP_VERSION_ID < 70400
+ static size_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count)
++#else
++static ssize_t php_plain_files_dirstream_read(php_stream *stream, char *buf, size_t count)
++#endif
+ {
+ DIR *dir = (DIR*) stream->abstract;
+ struct dirent *result;