From cd1dd050d4e079fd3afbadefe5859965b50c59ee Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 30 Nov 2021 10:06:23 +0100 Subject: add patch for PHP 8.1 from https://github.com/laruence/yaconf/pull/66 --- .gitignore | 2 ++ 66.patch | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ PHPINFO | 2 +- REFLECTION | 4 +-- php-pecl-yaconf.spec | 34 ++++++++++--------------- 5 files changed, 91 insertions(+), 23 deletions(-) create mode 100644 66.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/66.patch b/66.patch new file mode 100644 index 0000000..beaf8be --- /dev/null +++ b/66.patch @@ -0,0 +1,72 @@ +From 9ecaca42f0d168340e9f064c6756cd2404a090c6 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 30 Nov 2021 10:01:15 +0100 +Subject: [PATCH] zend_string instead of char * on PHP 8.1 + +--- + yaconf.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/yaconf.c b/yaconf.c +index a4869c7..9431aa7 100644 +--- a/yaconf.c ++++ b/yaconf.c +@@ -613,7 +613,11 @@ PHP_MINIT_FUNCTION(yaconf) + if (S_ISREG(sb.st_mode)) { + yaconf_filenode node; + if ((fh.handle.fp = VCWD_FOPEN(ini_file, "r"))) { ++#if PHP_VERSION_ID >= 80100 ++ fh.filename = zend_string_init(ini_file, strlen(ini_file), 0); ++#else + fh.filename = ini_file; ++#endif + fh.type = ZEND_HANDLE_FP; + ZVAL_UNDEF(&active_ini_file_section); + YACONF_G(parse_err) = 0; +@@ -623,8 +627,14 @@ PHP_MINIT_FUNCTION(yaconf) + YACONF_G(parse_err) = 0; + php_yaconf_hash_destroy(Z_ARRVAL(result)); + free(namelist[i]); ++#if PHP_VERSION_ID >= 80100 ++ zend_string_release(fh.filename); ++#endif + continue; + } ++#if PHP_VERSION_ID >= 80100 ++ zend_string_release(fh.filename); ++#endif + } + + php_yaconf_symtable_update(ini_containers, namelist[i]->d_name, p - namelist[i]->d_name, &result); +@@ -703,7 +713,11 @@ PHP_RINIT_FUNCTION(yaconf) + } + + if ((fh.handle.fp = VCWD_FOPEN(ini_file, "r"))) { ++#if PHP_VERSION_ID >= 80100 ++ fh.filename = zend_string_init(ini_file, strlen(ini_file), 0); ++#else + fh.filename = ini_file; ++#endif + fh.type = ZEND_HANDLE_FP; + ZVAL_UNDEF(&active_ini_file_section); + YACONF_G(parse_err) = 0; +@@ -713,6 +727,9 @@ PHP_RINIT_FUNCTION(yaconf) + YACONF_G(parse_err) = 0; + php_yaconf_hash_destroy(Z_ARRVAL(result)); + free(namelist[i]); ++#if PHP_VERSION_ID >= 80100 ++ zend_string_release(fh.filename); ++#endif + continue; + } + } +@@ -734,6 +751,9 @@ PHP_RINIT_FUNCTION(yaconf) + zend_hash_update_mem(parsed_ini_files, n.filename, &n, sizeof(yaconf_filenode)); + } + free(namelist[i]); ++#if PHP_VERSION_ID >= 80100 ++ zend_string_release(fh.filename); ++#endif + } + free(namelist); + } diff --git a/PHPINFO b/PHPINFO index 78f9ea5..90aba40 100644 --- a/PHPINFO +++ b/PHPINFO @@ -3,7 +3,7 @@ yaconf yaconf support => enabled version => 1.1.0 -yaconf config last check time => Thu Mar 12 07:47:05 2020 +yaconf config last check time => Tue Nov 30 10:06:06 2021 parsed filename => mtime diff --git a/REFLECTION b/REFLECTION index 1f7b42a..9b4aa52 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #112 yaconf version 1.1.0 ] { +Extension [ extension #119 yaconf version 1.1.0 ] { - INI { Entry [ yaconf.directory ] @@ -23,7 +23,7 @@ Extension [ extension #112 yaconf version 1.1.0 ] { - Parameters [2] { Parameter #0 [ $name ] - Parameter #1 [ $default ] + Parameter #1 [ $default = ] } } diff --git a/php-pecl-yaconf.spec b/php-pecl-yaconf.spec index cf87495..753347e 100644 --- a/php-pecl-yaconf.spec +++ b/php-pecl-yaconf.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-yaconf # -# Copyright (c) 2015-2020 Remi Collet +# Copyright (c) 2015-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -26,14 +26,16 @@ URL: https://github.com/%{gh_owner}/%{gh_project} Release: 0.5.%{gh_date}.%{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}/%{gh_project}-%{version}-%{gh_short}.tar.gz %else -Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz %endif Patch0: https://patch-diff.githubusercontent.com/raw/laruence/yaconf/pull/63.patch +Patch1: https://patch-diff.githubusercontent.com/raw/laruence/yaconf/pull/66.patch +BuildRequires: make BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel > 7 +BuildRequires: %{?scl_prefix}php-devel >= 7.0 BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} @@ -41,15 +43,15 @@ Requires: %{?scl_prefix}php(api) = %{php_core_api} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} %if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -%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 # Package have be renamed @@ -58,16 +60,6 @@ Provides: %{?scl_prefix}php-%{pecl_name} = %{version} 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 "%{?scl_prefix}" != "%{?sub_prefix}" -Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} -Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} -%endif - -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter shared private -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} -%endif %description @@ -99,6 +91,7 @@ mv %{pecl_name}-%{version} NTS cd NTS %patch0 -p1 -b .pr63 +%patch1 -p1 -b .pr66 # Sanity check, really often broken extver=$(sed -n '/#define PHP_YACONF_VERSION/{s/.* "//;s/".*$//;p}' php_yaconf.h) @@ -178,9 +171,8 @@ cd NTS : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ -NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests.php --show-diff || : ignore +%{__php} -n run-tests.php -q --show-diff || : ignore %if %{with_zts} cd ../ZTS @@ -192,9 +184,8 @@ cd ../ZTS : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ -NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php --show-diff +%{__ztsphp} -n run-tests.php -q --show-diff %endif @@ -242,6 +233,9 @@ fi %changelog +* Tue Nov 30 2021 Remi Collet - 1.1.0-4 +- add patch for PHP 8.1 from https://github.com/laruence/yaconf/pull/66 + * Wed Sep 30 2020 Remi Collet - 1.1.0-3 - rebuild for PHP 8.0.0RC1 -- cgit