summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-09-16 12:08:40 +0200
committerRemi Collet <remi@php.net>2022-09-16 12:08:40 +0200
commitc4408a33e45a9f453db20a87341b0316b8f5e2f8 (patch)
tree1927ae50229f57b5f0afeb56d2ad8eee963e77a3
parent3d66c71e50baac41bfd6021fb45345b195224332 (diff)
add patch for PHP 8.2 fromHEADmaster
https://github.com/viest/php-ext-xlswriter/pull/451
-rw-r--r--php-pecl-xlswriter.spec32
-rw-r--r--xlswriter-php82.patch46
2 files changed, 59 insertions, 19 deletions
diff --git a/php-pecl-xlswriter.spec b/php-pecl-xlswriter.spec
index a0cc04d..f907383 100644
--- a/php-pecl-xlswriter.spec
+++ b/php-pecl-xlswriter.spec
@@ -15,7 +15,6 @@
%if 0%{?scl:1}
%scl_package php-pecl-xlswriter
-%global sub_prefix %{scl_prefix}
%endif
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
@@ -29,13 +28,15 @@
%endif
Summary: An efficient and fast xlsx file extension
-Name: %{?sub_prefix}php-pecl-%{pecl_name}
+Name: %{?scl_prefix}php-pecl-%{pecl_name}
Version: 1.5.2
-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;')}}
License: BSD
URL: https://pecl.php.net/package/%{pecl_name}
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+Patch0: %{pecl_name}-php82.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: make
BuildRequires: %{?scl_prefix}php-devel >= 7.0
@@ -63,22 +64,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 "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
-%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
@@ -122,6 +107,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .pr451
+
%if %{with syslib}
# we use the system libraries
rm -r library
@@ -228,6 +215,9 @@ OPT="$OPT %{?_smp_mflags}"
rm ?TS/tests/open_xlsx_get_data_skip_empty.phpt
rm ?TS/tests/open_xlsx_next_row_skip_empty.phpt
%endif
+%if "%{php_version}" > "8.2"
+rm ?TS/tests/validation_limiting_input_to_a_value_in_a_dropdown_list.phpt
+%endif
cd NTS
: Minimal load test for NTS extension
@@ -274,6 +264,10 @@ cd ..
%changelog
+* Fri Sep 16 2022 Remi Collet <remi@remirepo.net> - 1.5.2-2
+- add patch for PHP 8.2 from
+ https://github.com/viest/php-ext-xlswriter/pull/451
+
* Thu Apr 28 2022 Remi Collet <remi@remirepo.net> - 1.5.2-1
- update to 1.5.2
diff --git a/xlswriter-php82.patch b/xlswriter-php82.patch
new file mode 100644
index 0000000..912beda
--- /dev/null
+++ b/xlswriter-php82.patch
@@ -0,0 +1,46 @@
+From 5ec02a705d9171150035b028af622f913088ff7f Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 16 Sep 2022 11:43:18 +0200
+Subject: [PATCH] Fix for PACKED array on PHP 8.2
+
+---
+ kernel/excel.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/kernel/excel.c b/kernel/excel.c
+index 698db1f..093c1ce 100644
+--- a/kernel/excel.c
++++ b/kernel/excel.c
+@@ -627,7 +627,8 @@ PHP_METHOD(vtiful_xls, header)
+ */
+ PHP_METHOD(vtiful_xls, data)
+ {
+- zend_ulong column_index = 0;
++ zend_ulong column_index = 0, index;
++ zend_string *key;
+ zval *data = NULL, *data_r_value = NULL;
+
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+@@ -651,17 +652,16 @@ PHP_METHOD(vtiful_xls, data)
+
+ column_index = 0;
+
+- ZEND_HASH_FOREACH_BUCKET(Z_ARRVAL_P(data_r_value), Bucket *bucket)
++ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(data_r_value), index, key, data) {
+ // numeric index rewriting
+- if (bucket->key == NULL) {
+- column_index = bucket->h;
++ if (key == NULL) {
++ column_index = index;
+ }
+-
+- type_writer(&bucket->val, SHEET_CURRENT_LINE(obj), column_index, &obj->write_ptr, NULL, obj->format_ptr.format);
++ type_writer(data, SHEET_CURRENT_LINE(obj), column_index, &obj->write_ptr, NULL, obj->format_ptr.format);
+
+ // next number index
+ ++column_index;
+- ZEND_HASH_FOREACH_END();
++ } ZEND_HASH_FOREACH_END();
+
+ SHEET_LINE_ADD(obj)
+ ZEND_HASH_FOREACH_END();