diff options
-rw-r--r-- | php-pecl-yaf.spec | 34 | ||||
-rw-r--r-- | yaf-php82.patch | 85 |
2 files changed, 101 insertions, 18 deletions
diff --git a/php-pecl-yaf.spec b/php-pecl-yaf.spec index 20c0de2..54b86e1 100644 --- a/php-pecl-yaf.spec +++ b/php-pecl-yaf.spec @@ -11,9 +11,11 @@ %undefine _strict_symbol_defs_build %if 0%{?scl:1} -%scl_package php-pecl-yaf +%scl_package php-pecl-yaf %endif +%bcond_without tests + %global gh_commit 51e458e9746d7061efc565d49baaca26feacd7ff %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner laruence @@ -30,13 +32,15 @@ Version: 3.3.5 Release: 0.13.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz %else -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;')}} Source: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz %endif License: PHP URL: https://pecl.php.net/package/yaf Source1: %{pecl_name}.ini +Patch0: %{pecl_name}-php82.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.0 @@ -54,22 +58,6 @@ Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -%if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.0" -Obsoletes: php80-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.1" -Obsoletes: php81-pecl-%{pecl_name} <= %{version} -%endif -%endif - %description The Yet Another Framework (Yaf) extension is a PHP framework that is used @@ -93,6 +81,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .pr579 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_YAF_VERSION/{s/.*\t"//;s/".*$//;p}' php_yaf.h ) if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then @@ -155,11 +145,13 @@ cd NTS --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' +%if %{with tests} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="$OPTS -d extension=$PWD/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ %{__php} -n run-tests.php -q --show-diff +%endif %if %{with_zts} cd ../ZTS @@ -169,12 +161,14 @@ cd ../ZTS --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' +%if %{with tests} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="$OPTS -d extension=$PWD/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ %{__ztsphp} -n run-tests.php -q --show-diff %endif +%endif %if 0%{?fedora} < 24 && 0%{?rhel} < 8 @@ -212,6 +206,10 @@ fi %changelog +* Mon Sep 19 2022 Remi Collet <remi@remirepo.net> - 3.3.5-2 +- add patch for PHP 8.2 from + https://github.com/laruence/yaf/pull/579 + * Mon May 23 2022 Remi Collet <remi@remirepo.net> - 3.3.5-1 - update to 3.3.5 diff --git a/yaf-php82.patch b/yaf-php82.patch new file mode 100644 index 0000000..9bbacae --- /dev/null +++ b/yaf-php82.patch @@ -0,0 +1,85 @@ +From e1557c8f219651550633567054af9c3298524c7e Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 19 Sep 2022 11:44:33 +0200 +Subject: [PATCH] Fix PHP 8.2 compatibility + +--- + requests/yaf_request_simple.c | 3 +++ + tests/031.phpt | 2 +- + tests/issue231.phpt | 2 +- + views/yaf_view_simple.c | 4 +++- + yaf_application.c | 4 +++- + 5 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/requests/yaf_request_simple.c b/requests/yaf_request_simple.c +index 6e7ff540..9c63d1c4 100644 +--- a/requests/yaf_request_simple.c ++++ b/requests/yaf_request_simple.c +@@ -140,6 +140,9 @@ YAF_STARTUP_FUNCTION(request_simple){ + zend_class_entry ce; + YAF_INIT_CLASS_ENTRY(ce, "Yaf_Request_Simple", "Yaf\\Request\\Simple", yaf_request_simple_methods); + yaf_request_simple_ce = zend_register_internal_class_ex(&ce, yaf_request_ce); ++#if PHP_VERSION_ID >= 80200 ++ yaf_request_simple_ce->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES; ++#endif + + return SUCCESS; + } +diff --git a/tests/031.phpt b/tests/031.phpt +index 19e9f79f..3474aa63 100644 +--- a/tests/031.phpt ++++ b/tests/031.phpt +@@ -36,7 +36,7 @@ Array + ) + array ( + '_default' => +- Yaf_Route_Map::__set_state(array( ++ %saf_Route_Map::__set_state(array( + 'ctl_prefer:protected' => true, + 'delimiter:protected' => '##', + )), +diff --git a/tests/issue231.phpt b/tests/issue231.phpt +index da656f87..44abc592 100644 +--- a/tests/issue231.phpt ++++ b/tests/issue231.phpt +@@ -34,7 +34,7 @@ Yaf_Request_Http Object + ) + + ) +-Yaf_Request_Http::__set_state(array( ++%saf_Request_Http::__set_state(array( + 'method' => 'POST', + 'module' => NULL, + 'controller' => NULL, +diff --git a/views/yaf_view_simple.c b/views/yaf_view_simple.c +index 229339e9..7402fed7 100755 +--- a/views/yaf_view_simple.c ++++ b/views/yaf_view_simple.c +@@ -388,8 +388,10 @@ static int yaf_view_simple_eval(yaf_view_t *view, zend_string *tpl, zval * vars, + ZVAL_STR(&phtml, strpprintf(0, "?>%s", ZSTR_VAL(tpl))); + #if PHP_VERSION_ID < 80000 + op_array = zend_compile_string(&phtml, eval_desc); +-#else ++#elif PHP_VERSION_ID < 80200 + op_array = zend_compile_string(Z_STR(phtml), eval_desc); ++#else ++ op_array = zend_compile_string(Z_STR(phtml), eval_desc, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG); + #endif + zval_dtor(&phtml); + efree(eval_desc); +diff --git a/yaf_application.c b/yaf_application.c +index 44b8e9e8..335b6d44 100644 +--- a/yaf_application.c ++++ b/yaf_application.c +@@ -1053,8 +1053,10 @@ YAF_STARTUP_FUNCTION(application) { + yaf_application_ce->ce_flags |= ZEND_ACC_FINAL; + yaf_application_ce->serialize = zend_class_serialize_deny; + yaf_application_ce->unserialize = zend_class_unserialize_deny; +-#else ++#elif PHP_VERSION_ID < 80200 + yaf_application_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; ++#else ++ yaf_application_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE | ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES; + #endif + + memcpy(&yaf_application_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); |