diff options
| -rw-r--r-- | PHPINFO | 6 | ||||
| -rw-r--r-- | REFLECTION | 29 | ||||
| -rw-r--r-- | composer.json | 31 | ||||
| -rw-r--r-- | php-pecl-rar.spec | 75 | ||||
| -rw-r--r-- | rar-php81.patch | 152 |
5 files changed, 95 insertions, 198 deletions
@@ -2,6 +2,6 @@ rar RAR support => enabled -RAR EXT version => 4.2.0 -UnRAR version => 6.00 beta2 patch1 2020-11-12 -UnRAR API version => 8 extension 1 +RAR EXT version => 4.3.0 +UnRAR version => 7.20 patch1 2026-02-01 +UnRAR API version => 9 extension 1 @@ -1,12 +1,12 @@ -Extension [ <persistent> extension #125 rar version 4.2.0 ] { +Extension [ <persistent> extension #111 rar version 4.3.0 ] { - Constants [6] { - Constant [ int RAR_HOST_MSDOS ] { 0 } - Constant [ int RAR_HOST_OS2 ] { 1 } - Constant [ int RAR_HOST_WIN32 ] { 2 } - Constant [ int RAR_HOST_UNIX ] { 3 } - Constant [ int RAR_HOST_MACOS ] { 4 } - Constant [ int RAR_HOST_BEOS ] { 5 } + Constant [ <persistent> int RAR_HOST_MSDOS ] { 0 } + Constant [ <persistent> int RAR_HOST_OS2 ] { 1 } + Constant [ <persistent> int RAR_HOST_WIN32 ] { 2 } + Constant [ <persistent> int RAR_HOST_UNIX ] { 3 } + Constant [ <persistent> int RAR_HOST_MACOS ] { 4 } + Constant [ <persistent> int RAR_HOST_BEOS ] { 5 } } - Functions { @@ -217,20 +217,35 @@ Extension [ <persistent> extension #125 rar version 4.2.0 ] { } - Properties [15] { + Property [ private $rarfile = NULL ] + Property [ private $position = NULL ] + Property [ private $name = NULL ] + Property [ private $unpacked_size = NULL ] + Property [ private $packed_size = NULL ] + Property [ private $host_os = NULL ] + Property [ private $file_time = NULL ] + Property [ private $crc = NULL ] + Property [ private $attr = NULL ] + skywalking_agent.properties_report_period_factor Property [ private $version = NULL ] + Property [ private $method = NULL ] + Property [ private $flags = NULL ] + Property [ private $redir_type = NULL ] + Property [ private $redir_to_directory = NULL ] + Property [ private $redir_target = NULL ] } diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..6f683e6 --- /dev/null +++ b/composer.json @@ -0,0 +1,31 @@ +{ + "name": "cataphract/rar", + "type": "php-ext", + "description": "PHP extension for reading RAR archives using bundled unRAR library", + "license": "PHP-3.01", + "authors": [ + { + "name": "Gustavo Lopes", + "email": "cataphract@php.net", + "role": "lead" + }, + { + "name": "Antony Dovgal", + "email": "tony@daylessday.org", + "role": "developer" + } + ], + "require": { + "php": "^7.0 || ^8.0" + }, + "replace": { + "ext-rar": "*" + }, + "support": { + "source": "https://github.com/cataphract/php-rar" + }, + "php-ext": { + "extension-name": "rar", + "download-url-method": ["pre-packaged-binary", "composer-default"] + } +} diff --git a/php-pecl-rar.spec b/php-pecl-rar.spec index f69f731..3e78c3b 100644 --- a/php-pecl-rar.spec +++ b/php-pecl-rar.spec @@ -1,6 +1,6 @@ # spec file for php-pecl-rar # -# SPDX-FileCopyrightText: Copyright 2013-2025 Remi Collet +# SPDX-FileCopyrightText: Copyright 2013-2026 Remi Collet # SPDX-License-Identifier: CECILL-2.1 # http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt # @@ -11,36 +11,46 @@ %bcond_without tests %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global pie_vend cataphract +%global pie_proj rar %global pecl_name rar %global ini_name 40-%{pecl_name}.ini -%global sources %{pecl_name}-%{version} +%global sources %{archivename} %global _configure ../%{sources}/configure +# Github forge +%global gh_vend %{pie_vend} +%global gh_proj php-rar +%global forgeurl https://github.com/%{gh_vend}/%{gh_proj} +%global tag v%{version} +# for EL-8 to avoid TAG usage +%global archivename %{gh_proj}-%{version} Summary: PHP extension for reading RAR archives Name: %{?scl_prefix}php-pecl-%{pecl_name} -Version: 4.2.0 -Release: 6%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Version: 4.3.0 +%forgemeta +Release: 1%{?dist} License: PHP-3.01 and Freeware with further limitations Group: Development/Languages -URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{sources}.tgz - -Patch0: %{pecl_name}-php81.patch -Patch1: %{pecl_name}-php82.patch -Patch2: %{pecl_name}-php83.patch +URL: %{forgeurl} +Source0: %{forgesource} BuildRequires: make BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel -BuildRequires: %{?scl_prefix}php-pear +BuildRequires: %{?scl_prefix}php-devel >= 7.0 Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} -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} +# Extension +Provides: %{?scl_prefix}php-%{pecl_name} = %{version} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} +# PECL +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +# PIE +Provides: %{?scl_prefix}php-pie(%{pie_vend}/%{pie_proj}) = %{version} +Provides: %{?scl_prefix}php-%{pie_vend}-%{pie_proj} = %{version} %description @@ -54,15 +64,8 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -# Don't install/register tests -sed -e 's/role="test"/role="src"/' \ - -e '/LICENSE/s/role="doc"/role="src"/' \ - -i package.xml - cd %{sources} -%patch -P0 -p1 -%patch -P1 -p1 -%patch -P2 -p1 +sed -e '/PHP_RAR_VERSION/s/4.2.0/%{version}/' -i php_rar.h # Sanity check, really often broken extver=$(sed -n '/#define PHP_RAR_VERSION/{s/.* "//;s/".*$//;p}' php_rar.h) @@ -117,21 +120,12 @@ cd ../ZTS # install config file install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} -# Install XML package description -install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml - %if %{with_zts} %make_install -C ZTS install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif -# Documentation -for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do - install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i -done - %check cd %{sources} @@ -149,7 +143,7 @@ rm tests/065.phpt TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d fatal_error_backtraces=0 -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{__php} -n run-tests8.php -q --show-diff +%{__php} -n run-tests-rar.php -q --show-diff %endif @@ -164,8 +158,7 @@ REPORT_EXIT_STATUS=1 \ %files %license %{sources}/LICENSE %license %{sources}/unrar/LICENSE.txt -%doc %{pecl_docdir}/%{pecl_name} -%{pecl_xmldir}/%{name}.xml +%doc %{sources}/*.md %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so @@ -176,6 +169,16 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Mon Mar 9 2026 Remi Collet <remi@remirepo.net> - 4.3.0-1 +- update to 4.3.0 +- add pie virtual provides +- drop pear/pecl dependency +- sources from github + +* Thu Jul 17 2025 Remi Collet <remi@remirepo.net> - 4.2.0-7 +- fix build with PHP 8.5.0alpha2 using patch from + https://github.com/cataphract/php-rar/pull/18 + * Thu Jul 10 2025 Remi Collet <remi@remirepo.net> - 4.2.0-6 - re-license spec file to CECILL-2.1 diff --git a/rar-php81.patch b/rar-php81.patch deleted file mode 100644 index 4f4407b..0000000 --- a/rar-php81.patch +++ /dev/null @@ -1,152 +0,0 @@ -From ab26d285759e4c917879967b09976a44829ed570 Mon Sep 17 00:00:00 2001 -From: Gustavo Lopes <mail@geleia.net> -Date: Mon, 16 Aug 2021 01:28:05 +0100 -Subject: [PATCH] Fixes for PHP 8.1 - ---- - rar_stream.c | 6 ++++++ - rararch.c | 8 +++++++- - rarentry.c | 26 +++++++++++++++----------- - tests/047.phpt | 6 +++--- - 4 files changed, 31 insertions(+), 15 deletions(-) - -diff --git a/rar_stream.c b/rar_stream.c -index 6fe207a..c6546a6 100644 ---- a/rar_stream.c -+++ b/rar_stream.c -@@ -784,7 +784,13 @@ static int _rar_get_archive_and_fragment(php_stream_wrapper *wrapper, - #if PHP_MAJOR_VERSION < 7 - *archive = zend_resolve_path(tmp_archive, tmp_arch_len TSRMLS_CC); - #else -+# if PHP_VERSION_ID < 80100 - zend_string *arc_str = zend_resolve_path(tmp_archive, tmp_arch_len); -+# else -+ zend_string *tmp_archive_str = zend_string_init_fast(tmp_archive, tmp_arch_len); -+ zend_string *arc_str = zend_resolve_path(tmp_archive_str); -+ zend_string_free(tmp_archive_str); -+# endif - if (arc_str != NULL) { - *archive = estrndup(arc_str->val, arc_str->len); - } else { -diff --git a/rararch.c b/rararch.c -index ed79f10..7cbfa26 100644 ---- a/rararch.c -+++ b/rararch.c -@@ -28,6 +28,7 @@ - /* $Id$ */ - - #include "zend_types.h" -+#include <zend_API.h> - #ifdef __cplusplus - extern "C" { - #endif -@@ -962,6 +963,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_rararchive_setallowbroken, 0, 0, 1) - ZEND_ARG_INFO(0, allow_broken) - ZEND_END_ARG_INFO() - -+#if PHP_MAJOR_VERSION >= 8 -+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_rararchive_getiterator, 0, 0, Traversable, 0) -+ZEND_END_ARG_INFO() -+#endif -+ - ZEND_BEGIN_ARG_INFO(arginfo_rararchive_void, 0) - ZEND_END_ARG_INFO() - /* }}} */ -@@ -981,7 +987,7 @@ static zend_function_entry php_rararch_class_functions[] = { - PHP_ME(rararch, __toString, arginfo_rararchive_void, ZEND_ACC_PUBLIC) - PHP_ME_MAPPING(__construct, rar_bogus_ctor, arginfo_rararchive_void, ZEND_ACC_PRIVATE | ZEND_ACC_CTOR) - #if PHP_MAJOR_VERSION >= 8 -- PHP_ME(rararch, getIterator, arginfo_rararchive_void, ZEND_ACC_PUBLIC) -+ PHP_ME(rararch, getIterator, arginfo_rararchive_getiterator, ZEND_ACC_PUBLIC) - #endif - {NULL, NULL, NULL} - }; -diff --git a/rarentry.c b/rarentry.c -index 5943f38..5e680f6 100644 ---- a/rarentry.c -+++ b/rarentry.c -@@ -27,11 +27,10 @@ - - /* $Id$ */ - --#ifdef __cplusplus --extern "C" { -+#include <zend_types.h> -+#ifndef _GNU_SOURCE -+# define _GNU_SOURCE - #endif -- --#define _GNU_SOURCE - #include <string.h> - - #include <php.h> -@@ -270,8 +269,8 @@ static void _rar_dos_date_to_text(unsigned dos_time, char *date_string) /* {{{ * - /* }}} */ - - /* {{{ Methods */ --/* {{{ proto bool RarEntry::extract(string dir [, string filepath = '' -- [, string password = NULL [, bool extended_data = FALSE]]) -+/* {{{ public function extract(?string $dir, ?string $filepath = '', -+ ?string $password = null, bool $extended_data = false): void {} - Extract file from the archive */ - PHP_METHOD(rarentry, extract) - { /* lots of variables, but no need to be intimidated */ -@@ -298,7 +297,7 @@ PHP_METHOD(rarentry, extract) - * password that's different from the one stored in the rar_file_t object*/ - rar_cb_user_data cb_udata = {NULL}; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ss!b", &dir, -+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s!|s!s!b", &dir, - &dir_len, &filepath, &filepath_len, &password, &password_len, - &process_ed) == FAILURE ) { - return; -@@ -714,12 +713,21 @@ PHP_METHOD(rarentry, __toString) - /* }}} */ - - /* {{{ arginfo */ -+#if PHP_MAJOR_VERSION < 8 - ZEND_BEGIN_ARG_INFO_EX(arginfo_rarentry_extract, 0, 0, 1) - ZEND_ARG_INFO(0, path) - ZEND_ARG_INFO(0, filename) - ZEND_ARG_INFO(0, password) - ZEND_ARG_INFO(0, extended_data) - ZEND_END_ARG_INFO() -+#else -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_rarentry_extract, 0, 1, _IS_BOOL, 0) -+ ZEND_ARG_TYPE_INFO(0, dir, IS_STRING, 1) -+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, filepath, IS_STRING, 1, "\'\'") -+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null") -+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extended_data, _IS_BOOL, 0, "false") -+ZEND_END_ARG_INFO() -+#endif - - ZEND_BEGIN_ARG_INFO_EX(arginfo_rarentry_getstream, 0, 0, 0) - ZEND_ARG_INFO(0, password) -@@ -829,7 +837,3 @@ void minit_rarentry(TSRMLS_D) - REG_RAR_CLASS_CONST_LONG("ATTRIBUTE_UNIX_SYM_LINK", 0x0A000L); - REG_RAR_CLASS_CONST_LONG("ATTRIBUTE_UNIX_SOCKET", 0x0C000L); - } -- --#ifdef __cplusplus --} --#endif -diff --git a/tests/047.phpt b/tests/047.phpt -index b1b5f53..8bd3e90 100644 ---- a/tests/047.phpt -+++ b/tests/047.phpt -@@ -10,9 +10,9 @@ function resolve($vol) { - else - return null; - } --function int32_to_hex($value) { -- $value &= 0xffffffff; -- return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT); -+function int32_to_hex($value) { -+ $value &= 0xffffffff; -+ return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT); - } - echo "Fail:\n"; - $rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar'); --- -2.31.1 - |
