From cb8de1966a7f2a537ae6d2336795e420305e419c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 18 Jul 2018 11:11:29 +0200 Subject: update to 2.9.3, in sync with Fedora --- 4.patch | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++- php-pecl-rar.spec | 9 +++- 2 files changed, 163 insertions(+), 2 deletions(-) diff --git a/4.patch b/4.patch index e8acd50..c5b70ab 100644 --- a/4.patch +++ b/4.patch @@ -1,7 +1,7 @@ From 1225c9240e0e368dad6ccc5f618e000560b4925d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 26 Jun 2018 15:22:42 +0200 -Subject: [PATCH] relax tests for 7.3 (bool/boolean, main/count) +Subject: [PATCH 1/2] relax tests for 7.3 (bool/boolean, main/count) --- tests/002.phpt | 2 +- @@ -89,3 +89,157 @@ index 39b8331..6ddd6f2 100644 int(0) * broken file; allow broken + +From 5ca8d78562769fe38c0b8d1b2bcb586f18ca6dd5 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 18 Jul 2018 11:02:14 +0200 +Subject: [PATCH 2/2] fix for iterator changes in 7.3.0alpha4 + +--- + rar_error.c | 2 +- + rararch.c | 104 ++++++++++++++++++++++++++++++++---------------------------- + 2 files changed, 56 insertions(+), 50 deletions(-) + +diff --git a/rar_error.c b/rar_error.c +index 447a19d..13a742b 100644 +--- a/rar_error.c ++++ b/rar_error.c +@@ -252,7 +252,7 @@ void minit_rarerror(TSRMLS_D) /* {{{ */ + rarexception_ce_ptr->ce_flags |= ZEND_ACC_FINAL; + zend_declare_property_bool(rarexception_ce_ptr, "usingExceptions", + sizeof("usingExceptions") -1, 0L /* FALSE */, +- ZEND_ACC_PRIVATE | ZEND_ACC_STATIC TSRMLS_CC); ++ ZEND_ACC_STATIC TSRMLS_CC); + } + /* }}} */ + +diff --git a/rararch.c b/rararch.c +index 1c065df..06ed9ca 100644 +--- a/rararch.c ++++ b/rararch.c +@@ -932,55 +932,6 @@ static void rararch_it_move_forward(zend_object_iterator *iter TSRMLS_DC); + static void rararch_it_rewind(zend_object_iterator *iter TSRMLS_DC); + /* }}} */ + +-/* {{{ rararch_it_get_iterator */ +-static zend_object_iterator *rararch_it_get_iterator(zend_class_entry *ce, +- zval *object, +- int by_ref TSRMLS_DC) +-{ +- rararch_iterator *it; +- rar_file_t *rar; +- int res; +- +- if (by_ref) { +- php_error_docref(NULL TSRMLS_CC, E_ERROR, +- "An iterator cannot be used with foreach by reference"); +- } +- +- it = emalloc(sizeof *it); +- +-#if PHP_MAJOR_VERSION < 7 +- zval_add_ref(&object); +- it->parent.data = object; +- it->value = NULL; +-#else +- zend_iterator_init((zend_object_iterator *) it); +- ZVAL_COPY(&it->parent.data, object); +- ZVAL_UNDEF(&it->value); +-#endif +- +- it->parent.funcs = ce->iterator_funcs.funcs; +- it->state = NULL; +- +- res = _rar_get_file_resource_ex(object, &rar, 1 TSRMLS_CC); +- if (res == FAILURE) +- php_error_docref(NULL TSRMLS_CC, E_ERROR, +- "Cannot fetch RarArchive object"); +- if (rar->arch_handle == NULL) +- php_error_docref(NULL TSRMLS_CC, E_ERROR, +- "The archive is already closed, cannot give an iterator"); +- res = _rar_list_files(rar TSRMLS_CC); +- if (_rar_handle_error(res TSRMLS_CC) == FAILURE) { +- /* if it failed, do not expose the possibly incomplete entry list */ +- it->empty_iterator = 1; +- } +- else +- it->empty_iterator = 0; +- +- _rar_entry_search_start(rar, RAR_SEARCH_TRAVERSE, &it->state TSRMLS_CC); +- return (zend_object_iterator*) it; +-} +-/* }}} */ +- + /* {{{ rararch_it_invalidate_current */ + static void rararch_it_invalidate_current(zend_object_iterator *iter TSRMLS_DC) + { +@@ -1147,6 +1098,59 @@ static zend_object_iterator_funcs rararch_it_funcs = { + }; + /* }}} */ + ++/* {{{ rararch_it_get_iterator */ ++static zend_object_iterator *rararch_it_get_iterator(zend_class_entry *ce, ++ zval *object, ++ int by_ref TSRMLS_DC) ++{ ++ rararch_iterator *it; ++ rar_file_t *rar; ++ int res; ++ ++ if (by_ref) { ++ php_error_docref(NULL TSRMLS_CC, E_ERROR, ++ "An iterator cannot be used with foreach by reference"); ++ } ++ ++ it = emalloc(sizeof *it); ++ ++#if PHP_MAJOR_VERSION < 7 ++ zval_add_ref(&object); ++ it->parent.data = object; ++ it->value = NULL; ++#else ++ zend_iterator_init((zend_object_iterator *) it); ++ ZVAL_COPY(&it->parent.data, object); ++ ZVAL_UNDEF(&it->value); ++#endif ++ ++#if PHP_VERSION_ID < 70300 ++ it->parent.funcs = ce->iterator_funcs.funcs; ++#else ++ it->parent.funcs = &rararch_it_funcs; ++#endif ++ it->state = NULL; ++ ++ res = _rar_get_file_resource_ex(object, &rar, 1 TSRMLS_CC); ++ if (res == FAILURE) ++ php_error_docref(NULL TSRMLS_CC, E_ERROR, ++ "Cannot fetch RarArchive object"); ++ if (rar->arch_handle == NULL) ++ php_error_docref(NULL TSRMLS_CC, E_ERROR, ++ "The archive is already closed, cannot give an iterator"); ++ res = _rar_list_files(rar TSRMLS_CC); ++ if (_rar_handle_error(res TSRMLS_CC) == FAILURE) { ++ /* if it failed, do not expose the possibly incomplete entry list */ ++ it->empty_iterator = 1; ++ } ++ else ++ it->empty_iterator = 0; ++ ++ _rar_entry_search_start(rar, RAR_SEARCH_TRAVERSE, &it->state TSRMLS_CC); ++ return (zend_object_iterator*) it; ++} ++/* }}} */ ++ + void minit_rararch(TSRMLS_D) + { + zend_class_entry ce; +@@ -1170,7 +1174,9 @@ void minit_rararch(TSRMLS_D) + rararch_ce_ptr->clone = NULL; + rararch_ce_ptr->create_object = &rararch_ce_create_object; + rararch_ce_ptr->get_iterator = rararch_it_get_iterator; ++#if PHP_VERSION_ID < 70300 + rararch_ce_ptr->iterator_funcs.funcs = &rararch_it_funcs; ++#endif + zend_class_implements(rararch_ce_ptr TSRMLS_CC, 1, zend_ce_traversable); + } + diff --git a/php-pecl-rar.spec b/php-pecl-rar.spec index 79d19ce..f58c56f 100644 --- a/php-pecl-rar.spec +++ b/php-pecl-rar.spec @@ -19,7 +19,7 @@ Summary: PHP extension for reading RAR archives Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 4.0.0 -Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP and Freeware with further limitations Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} @@ -62,6 +62,10 @@ Obsoletes: php71w-pecl-%{pecl_name} Obsoletes: php72u-pecl-%{pecl_name} Obsoletes: php72w-pecl-%{pecl_name} %endif +%if "%{php_version}" > "7.3" +Obsoletes: php73u-pecl-%{pecl_name} +Obsoletes: php73w-pecl-%{pecl_name} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -223,6 +227,9 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Wed Jul 18 2018 Remi Collet - 4.0.0-3 +- rebuild for 7.3.0alpha4 new ABI + * Tue Jun 26 2018 Remi Collet - 4.0.0-2 - add patch for PHP 7.3 from https://github.com/cataphract/php-rar/pull/4 -- cgit