From f6310198d46dc98ebb4943280d361f1b3ac6b5c9 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 5 Sep 2023 16:01:28 +0200 Subject: add patch for PHP from discussion on https://github.com/rosmanov/pecl-eio/issues/19 --- eio-php83.patch | 28 ++++++++++++++++++++++++++++ php-pecl-eio.spec | 16 ++++++++++++---- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 eio-php83.patch diff --git a/eio-php83.patch b/eio-php83.patch new file mode 100644 index 0000000..522897c --- /dev/null +++ b/eio-php83.patch @@ -0,0 +1,28 @@ +diff --git a/php8/php_eio.c b/php8/php_eio.c +index e79d10f..c87ca82 100644 +--- a/php8/php_eio.c ++++ b/php8/php_eio.c +@@ -479,6 +479,10 @@ static void php_eio_custom_execute(eio_req *req) + ZVAL_NULL(&zarg); + } + ++#ifdef ZEND_CHECK_STACK_LIMIT ++ zend_call_stack_init(); ++#endif ++ + zend_call_method(Z_ISUNDEF(pf->obj) ? NULL : Z_OBJ_P(&pf->obj), pf->ce, &pf->func_ptr, + ZSTR_VAL(pf->func_ptr->common.function_name), + ZSTR_LEN(pf->func_ptr->common.function_name), +@@ -863,8 +867,11 @@ static inline void php_eio_init() + pid_t cur_pid = getpid(); + + if (php_eio_pid <= 0 || (php_eio_pid > 0 && cur_pid != php_eio_pid)) { +- /* Uninitialized or forked a process(which needs it's own eio pipe) */ ++#ifdef ZEND_CHECK_STACK_LIMIT ++ zend_call_stack_init(); ++#endif + ++ /* Uninitialized or forked a process(which needs it's own eio pipe) */ + if (php_eio_pipe_new()) { + php_error_docref(NULL, E_ERROR, + "Failed creating internal pipe: %s", strerror(errno)); diff --git a/php-pecl-eio.spec b/php-pecl-eio.spec index d7e7017..fd4aaa0 100644 --- a/php-pecl-eio.spec +++ b/php-pecl-eio.spec @@ -8,7 +8,7 @@ # %{?scl:%scl_package php-pecl-eio} -# Defined in Fedora >= 37 and RHEL >= 10, in PHP >= 7.4 for remirepo +# For PHP < 5.6 and EPEL-9 %{!?__phpize: %global __phpize %{_bindir}/phpize} %{!?__ztsphpize: %global __ztsphpize %{_bindir}/zts-phpize} %{!?__phpconfig: %global __phpconfig %{_bindir}/php-config} @@ -38,12 +38,14 @@ Summary: Provides interface to the libeio library Name: %{?scl_prefix}php-pecl-%{pecl_name} 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 PHP-3.01, library is BSD-2-Clause (or GPL-2.0-or-later) License: PHP-3.01 AND BSD-2-Clause URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Patch0: %{pecl_name}-php83.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -55,7 +57,6 @@ BuildRequires: %{?scl_prefix}php-posix Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-sockets%{?_isa} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -86,6 +87,9 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd %{sources} +%if "%{php_version}" >= "8.3" +%patch -P0 -p1 +%endif sed -e 's/3.0.0RC5/%{upstream_version}%{?upstream_prever}/' -i php%(%{__php} -r 'echo PHP_MAJOR_VERSION;')/php_eio.h @@ -183,7 +187,7 @@ DEPMOD= : Minimal load test for NTS extension cd %{sources} -%{_bindir}/php --no-php-ini \ +%{__php} --no-php-ini \ $DEPMOD \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} @@ -230,6 +234,10 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Tue Sep 5 2023 Remi Collet - 3.1.0~RC1-2 +- add patch for PHP from discussion on + https://github.com/rosmanov/pecl-eio/issues/19 + * Thu Jun 1 2023 Remi Collet - 3.1.0~RC1-1 - update to 3.1.0RC1 - build out of sources tree -- cgit