summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--0a1ab3d5b1cfde8b905192bec0535bc61b92871a.patch123
-rw-r--r--3686.patch23
-rw-r--r--7d4eaed41ae94237ed9e4ae72ac166b6e7617047.patch25
-rw-r--r--bebc3a0890156b9067b19f9c56766d132647fd58.patch41
-rw-r--r--php-pecl-swoole4.spec17
5 files changed, 228 insertions, 1 deletions
diff --git a/0a1ab3d5b1cfde8b905192bec0535bc61b92871a.patch b/0a1ab3d5b1cfde8b905192bec0535bc61b92871a.patch
new file mode 100644
index 0000000..8954a4f
--- /dev/null
+++ b/0a1ab3d5b1cfde8b905192bec0535bc61b92871a.patch
@@ -0,0 +1,123 @@
+From 0a1ab3d5b1cfde8b905192bec0535bc61b92871a Mon Sep 17 00:00:00 2001
+From: twosee <twose@qq.com>
+Date: Mon, 21 Sep 2020 19:05:45 +0800
+Subject: [PATCH] Fix PHP8 build (ext/sockets compatibility) (#3684)
+
+---
+ php_swoole.h | 14 +++++++++++++-
+ swoole_client.cc | 2 +-
+ swoole_event.cc | 14 +++++++++++---
+ swoole_server.cc | 2 +-
+ swoole_server_port.cc | 2 +-
+ 5 files changed, 27 insertions(+), 7 deletions(-)
+
+diff --git a/php_swoole.h b/php_swoole.h
+index 9137f21b8e..35be68aae7 100644
+--- a/php_swoole.h
++++ b/php_swoole.h
+@@ -487,7 +487,19 @@ static sw_inline void _sw_zend_bailout(const char *filename, uint32_t lineno)
+ (ptr) = &(val); \
+ } while (0)
+
+-#define SW_ZEND_REGISTER_RESOURCE(return_value, result, le_result) ZVAL_RES(return_value,zend_register_resource(result, le_result))
++#if PHP_VERSION_ID < 80000
++#define SW_ZVAL_SOCKET(return_value, result) \
++ ZVAL_RES(return_value,zend_register_resource((void *) (result), php_sockets_le_socket()))
++#else
++#define SW_ZVAL_SOCKET(return_value, result) \
++ ZVAL_OBJ(return_value, &result->std)
++#endif
++
++#if PHP_VERSION_ID < 80000
++#define SW_Z_SOCKET_P(zsocket) (php_socket *) zend_fetch_resource_ex(zsocket, nullptr, php_sockets_le_socket())
++#else
++#define SW_Z_SOCKET_P(zsocket) Z_SOCKET_P(zsocket)
++#endif
+
+ #ifndef ZVAL_IS_BOOL
+ static sw_inline zend_bool ZVAL_IS_BOOL(zval *v)
+diff --git a/swoole_client.cc b/swoole_client.cc
+index f2a23b8198..bc5de62d8d 100644
+--- a/swoole_client.cc
++++ b/swoole_client.cc
+@@ -1244,7 +1244,7 @@ static PHP_METHOD(swoole_client, getSocket) {
+ if (!socket_object) {
+ RETURN_FALSE;
+ }
+- SW_ZEND_REGISTER_RESOURCE(return_value, (void *) socket_object, php_sockets_le_socket());
++ SW_ZVAL_SOCKET(return_value, socket_object);
+ zsocket = sw_zval_dup(return_value);
+ Z_TRY_ADDREF_P(zsocket);
+ php_swoole_client_set_zsocket(ZEND_THIS, zsocket);
+diff --git a/swoole_event.cc b/swoole_event.cc
+index 8dfcca37f2..8cc7fc2996 100644
+--- a/swoole_event.cc
++++ b/swoole_event.cc
+@@ -318,7 +318,7 @@ int php_swoole_convert_to_fd(zval *zsocket) {
+ #ifdef SWOOLE_SOCKETS_SUPPORT
+ else {
+ php_socket *php_sock;
+- if ((php_sock = (php_socket *) zend_fetch_resource_ex(zsocket, nullptr, php_sockets_le_socket()))) {
++ if ((php_sock = SW_Z_SOCKET_P(zsocket))) {
+ fd = php_sock->bsd_socket;
+ return fd;
+ }
+@@ -372,7 +372,7 @@ int php_swoole_convert_to_fd_ex(zval *zsocket, int *async) {
+ #ifdef SWOOLE_SOCKETS_SUPPORT
+ else {
+ php_socket *php_sock;
+- if ((php_sock = (php_socket *) zend_fetch_resource_ex(zsocket, nullptr, php_sockets_le_socket()))) {
++ if ((php_sock = SW_Z_SOCKET_P(zsocket))) {
+ fd = php_sock->bsd_socket;
+ *async = 1;
+ return fd;
+@@ -386,7 +386,9 @@ int php_swoole_convert_to_fd_ex(zval *zsocket, int *async) {
+
+ #ifdef SWOOLE_SOCKETS_SUPPORT
+ php_socket *php_swoole_convert_to_socket(int sock) {
+- php_socket *socket_object = (php_socket *) emalloc(sizeof *socket_object);
++ php_socket *socket_object;
++#if PHP_VERSION_ID < 80000
++ socket_object = (php_socket *) emalloc(sizeof *socket_object);
+ sw_memset_zero(socket_object, sizeof(php_socket));
+ socket_object->bsd_socket = sock;
+ socket_object->blocking = 1;
+@@ -410,6 +412,12 @@ php_socket *php_swoole_convert_to_socket(int sock) {
+ } else {
+ socket_object->blocking = !(t & O_NONBLOCK);
+ }
++#else
++ zval zsocket;
++ object_init_ex(&zsocket, socket_ce);
++ socket_object = Z_SOCKET_P(&zsocket);
++ socket_import_file_descriptor(sock, socket_object);
++#endif
+ return socket_object;
+ }
+ #endif
+diff --git a/swoole_server.cc b/swoole_server.cc
+index 5605a5de45..6e56733692 100644
+--- a/swoole_server.cc
++++ b/swoole_server.cc
+@@ -3529,7 +3529,7 @@ static PHP_METHOD(swoole_server, getSocket) {
+ if (!socket_object) {
+ RETURN_FALSE;
+ }
+- SW_ZEND_REGISTER_RESOURCE(return_value, (void *) socket_object, php_sockets_le_socket());
++ SW_ZVAL_SOCKET(return_value, socket_object);
+ zval *zsocket = sw_zval_dup(return_value);
+ Z_TRY_ADDREF_P(zsocket);
+ }
+diff --git a/swoole_server_port.cc b/swoole_server_port.cc
+index 55093ea513..9be0b4e691 100644
+--- a/swoole_server_port.cc
++++ b/swoole_server_port.cc
+@@ -688,7 +688,7 @@ static PHP_METHOD(swoole_server_port, getSocket) {
+ if (!socket_object) {
+ RETURN_FALSE;
+ }
+- SW_ZEND_REGISTER_RESOURCE(return_value, (void *) socket_object, php_sockets_le_socket());
++ SW_ZVAL_SOCKET(return_value, socket_object);
+ zval *zsocket = sw_zval_dup(return_value);
+ Z_TRY_ADDREF_P(zsocket);
+ }
diff --git a/3686.patch b/3686.patch
new file mode 100644
index 0000000..09226cc
--- /dev/null
+++ b/3686.patch
@@ -0,0 +1,23 @@
+From 3ea5088acb27a4f2f0164b5621c54fb7b8767d47 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 21 Sep 2020 14:43:55 +0200
+Subject: [PATCH] fix build error: invalid conversion from 'const char*' to
+ 'char*'
+
+---
+ src/protocol/ssl.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/protocol/ssl.cc b/src/protocol/ssl.cc
+index c9069c1a8a..2f48e0ac72 100644
+--- a/src/protocol/ssl.cc
++++ b/src/protocol/ssl.cc
+@@ -512,7 +512,7 @@ static int swSSL_check_name(const char *name, ASN1_STRING *pattern) {
+ char *s, *end;
+ size_t slen, plen;
+
+- s = name;
++ s = (char *)name;
+ slen = strlen(name);
+
+ uchar *p = ASN1_STRING_data(pattern);
diff --git a/7d4eaed41ae94237ed9e4ae72ac166b6e7617047.patch b/7d4eaed41ae94237ed9e4ae72ac166b6e7617047.patch
new file mode 100644
index 0000000..e05780b
--- /dev/null
+++ b/7d4eaed41ae94237ed9e4ae72ac166b6e7617047.patch
@@ -0,0 +1,25 @@
+From 7d4eaed41ae94237ed9e4ae72ac166b6e7617047 Mon Sep 17 00:00:00 2001
+From: Yurun <admin@yurunsoft.com>
+Date: Sun, 20 Sep 2020 14:43:03 +0800
+Subject: [PATCH] Fix #3681 (#3682)
+
+---
+ src/protocol/ssl.cc | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/protocol/ssl.cc b/src/protocol/ssl.cc
+index 61a3e56c0e..c9069c1a8a 100644
+--- a/src/protocol/ssl.cc
++++ b/src/protocol/ssl.cc
+@@ -71,9 +71,11 @@ static int swSSL_verify_cookie(SSL *ssl, const uchar *cookie, uint cookie_len);
+ static void MAYBE_UNUSED swSSL_lock_callback(int mode, int type, const char *file, int line);
+
+ static const SSL_METHOD *swSSL_get_method(swSSL_option *option) {
++#ifdef SW_SUPPORT_DTLS
+ if (option->protocols & SW_SSL_DTLS) {
+ return DTLS_method();
+ }
++#endif
+ return SSLv23_method();
+ }
+
diff --git a/bebc3a0890156b9067b19f9c56766d132647fd58.patch b/bebc3a0890156b9067b19f9c56766d132647fd58.patch
new file mode 100644
index 0000000..307737b
--- /dev/null
+++ b/bebc3a0890156b9067b19f9c56766d132647fd58.patch
@@ -0,0 +1,41 @@
+From bebc3a0890156b9067b19f9c56766d132647fd58 Mon Sep 17 00:00:00 2001
+From: twosee <twose@qq.com>
+Date: Sat, 19 Sep 2020 07:15:07 +0800
+Subject: [PATCH] Fix PHP8 build (zend_compile_string change) (#3675)
+
+---
+ php_swoole_cxx.cc | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/php_swoole_cxx.cc b/php_swoole_cxx.cc
+index 0360cf2779..adfa535132 100644
+--- a/php_swoole_cxx.cc
++++ b/php_swoole_cxx.cc
+@@ -12,7 +12,13 @@ SW_API zend_string **sw_zend_known_strings = nullptr;
+
+ //----------------------------------Swoole known string------------------------------------
+
+-static zend_op_array *swoole_compile_string(zval *source_string, ZEND_STR_CONST char *filename);
++#if PHP_VERSION_ID < 80000
++typedef zval zend_source_string_t;
++#else
++typedef zend_string zend_source_string_t;
++#endif
++
++static zend_op_array *swoole_compile_string(zend_source_string_t *source_string, ZEND_STR_CONST char *filename);
+
+ bool zend::include(std::string file) {
+ zend_file_handle file_handle;
+@@ -51,9 +57,10 @@ bool zend::include(std::string file) {
+ }
+
+ // for compatibly with dis_eval
+-static zend_op_array *(*old_compile_string)(zval *source_string, ZEND_STR_CONST char *filename);
+
+-static zend_op_array *swoole_compile_string(zval *source_string, ZEND_STR_CONST char *filename) {
++static zend_op_array *(*old_compile_string)(zend_source_string_t *source_string, ZEND_STR_CONST char *filename);
++
++static zend_op_array *swoole_compile_string(zend_source_string_t *source_string, ZEND_STR_CONST char *filename) {
+ zend_op_array *opa = old_compile_string(source_string, filename);
+ opa->type = ZEND_USER_FUNCTION;
+ return opa;
diff --git a/php-pecl-swoole4.spec b/php-pecl-swoole4.spec
index e2fbabe..2fe1009 100644
--- a/php-pecl-swoole4.spec
+++ b/php-pecl-swoole4.spec
@@ -34,13 +34,18 @@
Summary: PHP's asynchronous concurrent distributed networking framework
Name: %{?sub_prefix}php-pecl-%{pecl_name}4
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
-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: https://pecl.php.net/package/%{pecl_name}
Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
+Patch0: https://github.com/swoole/swoole-src/commit/bebc3a0890156b9067b19f9c56766d132647fd58.patch
+Patch1: https://github.com/swoole/swoole-src/commit/7d4eaed41ae94237ed9e4ae72ac166b6e7617047.patch
+Patch2: https://github.com/swoole/swoole-src/commit/0a1ab3d5b1cfde8b905192bec0535bc61b92871a.patch
+Patch3: https://patch-diff.githubusercontent.com/raw/swoole/swoole-src/pull/3686.patch
+
%if 0%{?rhel} == 6
BuildRequires: devtoolset-6-toolchain
%else
@@ -160,6 +165,11 @@ sed \
cd NTS
+%patch0 -p1 -b .up0
+%patch1 -p1 -b .up1
+%patch2 -p1 -b .up2
+%patch3 -p1 -b .pr3686
+
# Sanity check, really often broken
extver=$(sed -n '/#define SWOOLE_VERSION /{s/.* "//;s/".*$//;p}' include/swoole_version.h)
if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then
@@ -328,6 +338,11 @@ cd ../ZTS
%changelog
+* Sun Sep 20 2020 Remi Collet <remi@remirepo.net> - 4.5.4-2
+- add upstream patch for EL-6 and for PHP 8
+- add patch for EL-6 from
+ https://github.com/swoole/swoole-src/pull/3686
+
* Sun Sep 20 2020 Remi Collet <remi@remirepo.net> - 4.5.4-1
- update to 4.5.4
- open https://github.com/swoole/swoole-src/issues/3681 broken build on EL-6