From e8bf252eb7e1aa23b49dcfb638e1ff4e59d64b98 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 23 Jul 2019 14:42:57 +0200 Subject: rebuild for 7.4.0beta1 --- 2707.patch | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-swoole4.spec | 10 +++- 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 2707.patch 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 +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; diff --git a/php-pecl-swoole4.spec b/php-pecl-swoole4.spec index 0622d36..04af961 100644 --- a/php-pecl-swoole4.spec +++ b/php-pecl-swoole4.spec @@ -31,13 +31,15 @@ Summary: PHP's asynchronous concurrent distributed networking framework Name: %{?sub_prefix}php-pecl-%{pecl_name}4 Version: 4.4.1 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} # Extension is ASL 2.0 # Hiredis is BSD License: ASL 2.0 and BSD URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: https://patch-diff.githubusercontent.com/raw/swoole/swoole-src/pull/2707.patch + %if 0%{?rhel} == 6 BuildRequires: devtoolset-6-toolchain %else @@ -160,6 +162,8 @@ sed \ cd NTS +%patch0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define SWOOLE_VERSION /{s/.* "//;s/".*$//;p}' include/swoole.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -327,6 +331,10 @@ cd ../ZTS %changelog +* Tue Jul 23 2019 Remi Collet - 4.4.1-2 +- rebuild for 7.4.0beta1 +- add patch from https://github.com/swoole/swoole-src/pull/2707 + * Tue Jul 16 2019 Remi Collet - 4.4.1-1 - update to 4.4.1 -- cgit