diff options
-rw-r--r-- | php-pecl-zip.spec | 29 | ||||
-rw-r--r-- | zip-php83.patch | 154 |
2 files changed, 170 insertions, 13 deletions
diff --git a/php-pecl-zip.spec b/php-pecl-zip.spec index b73231b..9fa3e6f 100644 --- a/php-pecl-zip.spec +++ b/php-pecl-zip.spec @@ -3,8 +3,8 @@ # # fedora spec file for php-pecl-zip # -# Copyright (c) 2013-2022 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2013-2023 Remi Collet +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries @@ -16,11 +16,13 @@ %{?scl: %scl_package php-pecl-zip} %if ( 0%{?scl:1} && 0%{?rhel} == 8 ) || 0%{?rhel} >= 9 -%bcond_without move_to_opt +%bcond_without move_to_opt %else -%bcond_with move_to_opt +%bcond_with move_to_opt %endif +%bcond_without tests + %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name zip @@ -40,13 +42,15 @@ Summary: A ZIP archive management extension Name: %{?scl_prefix}php-pecl-zip Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}} -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License: PHP +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License: PHP-3.01 Group: Development/Languages URL: https://pecl.php.net/package/zip 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 @@ -77,7 +81,7 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} Provides: %{?scl_prefix}php-%{pecl_name} = 1:%{version}-%{release} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = 1:%{version}-%{release} -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} == 7 # Other third party repo stuff Obsoletes: php53-pecl-%{pecl_name} <= %{version} Obsoletes: php53u-pecl-%{pecl_name} <= %{version} @@ -111,12 +115,6 @@ Obsoletes: php73w-pecl-%{pecl_name} <= %{version} Obsoletes: php74-pecl-%{pecl_name} <= %{version} Obsoletes: php74w-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 %if "%{php_version}" > "7.0" @@ -142,6 +140,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch -P0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_ZIP_VERSION/{s/.* "//;s/".*$//;p}' php7/php_zip.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}" -a "x${extver}" != "x%{upstream_version}-%{?upstream_prever}"; then @@ -283,6 +283,9 @@ fi %changelog +* Mon Jun 5 2023 Remi Collet <remi@remirepo.net> - 1.21.1-2 +- add upstream patches for 8.3 + * Fri Sep 16 2022 Remi Collet <remi@remirepo.net> - 1.21.1-1 - update to 1.21.1 diff --git a/zip-php83.patch b/zip-php83.patch new file mode 100644 index 0000000..238d6a1 --- /dev/null +++ b/zip-php83.patch @@ -0,0 +1,154 @@ +From 85624b566aa4f3c9d0e676fbc6127795e1f77f24 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Tue, 30 May 2023 17:00:32 +0200 +Subject: [PATCH] sync changes from 8.3 + +--- + php81/php_zip.c | 25 +++++++++++++++++-------- + php81/php_zip.stub.php | 23 ++++++++++++++++++++++- + php81/php_zip_arginfo.h | 16 ++++++++++------ + 3 files changed, 49 insertions(+), 15 deletions(-) + +diff --git a/php81/php_zip.c b/php81/php_zip.c +index 1d7c7e9..4ba1319 100644 +--- a/php81/php_zip.c ++++ b/php81/php_zip.c +@@ -39,6 +39,10 @@ + #endif + #endif + ++#if PHP_VERSION_ID < 80300 ++#define zend_zval_value_name(opt) zend_zval_type_name(opt) ++#endif ++ + /* {{{ Resource le */ + static int le_zip_dir; + #define le_zip_dir_name "Zip Directory" +@@ -354,7 +358,7 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) + if ((option = zend_hash_str_find(options, "remove_all_path", sizeof("remove_all_path") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_FALSE && Z_TYPE_P(option) != IS_TRUE) { + php_error_docref(NULL, E_WARNING, "Option \"remove_all_path\" must be of type bool, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + } + opts->remove_all_path = zval_get_long(option); + } +@@ -362,14 +366,14 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) + if ((option = zend_hash_str_find(options, "comp_method", sizeof("comp_method") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_LONG) { + php_error_docref(NULL, E_WARNING, "Option \"comp_method\" must be of type int, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + } + opts->comp_method = zval_get_long(option); + + if ((option = zend_hash_str_find(options, "comp_flags", sizeof("comp_flags") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_LONG) { + php_error_docref(NULL, E_WARNING, "Option \"comp_flags\" must be of type int, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + } + opts->comp_flags = zval_get_long(option); + } +@@ -379,14 +383,14 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) + if ((option = zend_hash_str_find(options, "enc_method", sizeof("enc_method") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_LONG) { + php_error_docref(NULL, E_WARNING, "Option \"enc_method\" must be of type int, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + } + opts->enc_method = zval_get_long(option); + + if ((option = zend_hash_str_find(options, "enc_password", sizeof("enc_password") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_STRING) { + zend_type_error("Option \"enc_password\" must be of type string, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + return -1; + } + opts->enc_password = Z_STRVAL_P(option); +@@ -397,7 +401,7 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) + if ((option = zend_hash_str_find(options, "remove_path", sizeof("remove_path") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_STRING) { + zend_type_error("Option \"remove_path\" must be of type string, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + return -1; + } + +@@ -417,7 +421,7 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) + if ((option = zend_hash_str_find(options, "add_path", sizeof("add_path") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_STRING) { + zend_type_error("Option \"add_path\" must be of type string, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + return -1; + } + +@@ -437,7 +441,7 @@ static int php_zip_parse_options(HashTable *options, zip_options *opts) + if ((option = zend_hash_str_find(options, "flags", sizeof("flags") - 1)) != NULL) { + if (Z_TYPE_P(option) != IS_LONG) { + zend_type_error("Option \"flags\" must be of type int, %s given", +- zend_zval_type_name(option)); ++ zend_zval_value_name(option)); + return -1; + } + opts->flags = Z_LVAL_P(option); +@@ -1079,7 +1083,9 @@ static zend_object *php_zip_object_new(zend_class_entry *class_type) /* {{{ */ + intern->prop_handler = &zip_prop_handlers; + zend_object_std_init(&intern->zo, class_type); + object_properties_init(&intern->zo, class_type); ++#if PHP_VERSION_ID < 80300 + intern->zo.handlers = &zip_object_handlers; ++#endif + intern->last_id = -1; + + return &intern->zo; +@@ -3105,6 +3111,9 @@ static PHP_MINIT_FUNCTION(zip) + + zip_class_entry = register_class_ZipArchive(zend_ce_countable); + zip_class_entry->create_object = php_zip_object_new; ++#if PHP_VERSION_ID >= 80300 ++ zip_class_entry->default_object_handlers = &zip_object_handlers; ++#endif + + zend_hash_init(&zip_prop_handlers, 0, NULL, php_zip_free_prop_handler, 1); + php_zip_register_prop_handler(&zip_prop_handlers, "lastId", php_zip_last_id, NULL, IS_LONG); +From c26e4215686294971a13896e3da06312f4a18037 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 5 Jun 2023 16:31:35 +0200 +Subject: [PATCH] allow 8.3 + +--- + config.m4 | 4 ++-- + config.w32 | 2 ++ + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/config.m4 b/config.m4 +index 390108b..5d77eeb 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -27,8 +27,8 @@ if test "$PHP_ZIP" != "no"; then + elif test $PHP_VERSION -lt 80100; then + AC_MSG_RESULT(8.0) + subdir=php8 +- elif test $PHP_VERSION -lt 80300; then +- AC_MSG_RESULT(8.1/8.2) ++ elif test $PHP_VERSION -lt 80400; then ++ AC_MSG_RESULT(8.1/8.2/8.3) + subdir=php81 + else + AC_MSG_ERROR(PHP version $PHP_VERSION is not supported yet) +diff --git a/config.w32 b/config.w32 +index 1d1c3e0..da42ba3 100644 +--- a/config.w32 ++++ b/config.w32 +@@ -32,6 +32,8 @@ if (PHP_ZIP != "no") { + configure_module_dirname = configure_module_dirname + "\\php81"; + } else if (PHP_VERSION == 8 && PHP_MINOR_VERSION == 2) { + configure_module_dirname = configure_module_dirname + "\\php81"; ++ } else if (PHP_VERSION == 8 && PHP_MINOR_VERSION == 3) { ++ configure_module_dirname = configure_module_dirname + "\\php81"; + } else { + ERROR("PHP " + PHP_VERSION + "." + PHP_MINOR_VERSION + " not supported"); + } |