From ff1c2518bddb4c55bac3633b46b602576b9b8563 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 1 Mar 2023 16:41:56 +0100 Subject: update to 1.5.3 drop patch merged upstream add another patch for PHP 8.2 from https://github.com/viest/php-ext-xlswriter/pull/470 --- 0001-Another-fix-for-PACKED-array-on-PHP-8.2.patch | 66 ++++++++++++++++++++++ PHPINFO | 2 +- REFLECTION | 45 +++++++++++++-- php-pecl-xlswriter.spec | 29 +++++----- xlswriter-php82.patch | 46 --------------- 5 files changed, 120 insertions(+), 68 deletions(-) create mode 100644 0001-Another-fix-for-PACKED-array-on-PHP-8.2.patch delete mode 100644 xlswriter-php82.patch diff --git a/0001-Another-fix-for-PACKED-array-on-PHP-8.2.patch b/0001-Another-fix-for-PACKED-array-on-PHP-8.2.patch new file mode 100644 index 0000000..57df4ea --- /dev/null +++ b/0001-Another-fix-for-PACKED-array-on-PHP-8.2.patch @@ -0,0 +1,66 @@ +From 9ea164d4d8fb0af74bcb8fd41266582d7469fab1 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 1 Mar 2023 16:04:38 +0100 +Subject: [PATCH] Another fix for PACKED array on PHP 8.2 + +--- + kernel/validation.c | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/kernel/validation.c b/kernel/validation.c +index 8a07e76..a7c4178 100644 +--- a/kernel/validation.c ++++ b/kernel/validation.c +@@ -433,7 +433,7 @@ PHP_METHOD(vtiful_validation, valueList) + int index = 0; + char **list = NULL; + +- Bucket *bucket; ++ zval *data; + zval *zv_value_list = NULL; + validation_object *obj = NULL; + +@@ -465,25 +465,25 @@ PHP_METHOD(vtiful_validation, valueList) + + zend_array *za_value_list = Z_ARR_P(zv_value_list); + +- ZEND_HASH_FOREACH_BUCKET(za_value_list, bucket) +- if (Z_TYPE(bucket->val) != IS_STRING) { ++ ZEND_HASH_FOREACH_VAL(za_value_list, data) { ++ if (Z_TYPE_P(data) != IS_STRING) { + zend_throw_exception(vtiful_exception_ce, "Arrays can only consist of strings.", 300); + return; + } +- if (ZSTR_LEN(bucket->val.value.str) == 0 ) { ++ if (Z_STRLEN_P(data) == 0 ) { + zend_throw_exception(vtiful_exception_ce, "Array value is empty string.", 301); + return; + } +- ZEND_HASH_FOREACH_END(); ++ } ZEND_HASH_FOREACH_END(); + + index = 0; + list = ecalloc(za_value_list->nNumOfElements + 1, sizeof(char *)); + +- ZEND_HASH_FOREACH_BUCKET(za_value_list, bucket) +- list[index] = ecalloc(1, bucket->val.value.str->len + 1); +- strcpy(list[index],bucket->val.value.str->val); ++ ZEND_HASH_FOREACH_VAL(za_value_list, data) { ++ list[index] = ecalloc(1, Z_STRLEN_P(data) + 1); ++ strcpy(list[index], Z_STRVAL_P(data)); + index++; +- ZEND_HASH_FOREACH_END(); ++ } ZEND_HASH_FOREACH_END(); + + list[index] = NULL; + +@@ -823,4 +823,4 @@ VTIFUL_STARTUP_FUNCTION(validation) { + + return SUCCESS; + } +-/* }}} */ +\ No newline at end of file ++/* }}} */ +-- +2.39.2 + diff --git a/PHPINFO b/PHPINFO index a7bc26a..4c092f8 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,6 +2,6 @@ xlswriter xlswriter support => enabled -Version => 1.5.2 +Version => 1.5.3 bundled libxlsxwriter version => 1.1.3 bundled libxlsxio version => 0.2.27 diff --git a/REFLECTION b/REFLECTION index 79463f0..4a6db45 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #103 xlswriter version 1.5.2 ] { +Extension [ extension #103 xlswriter version 1.5.3 ] { - Functions { Function [ function xlswriter_get_version ] { @@ -28,8 +28,8 @@ Extension [ extension #103 xlswriter version 1.5.2 ] { - Properties [4] { Property [ protected $message = '' ] Property [ protected $code = 0 ] - Property [ protected $file = NULL ] - Property [ protected $line = NULL ] + Property [ protected string $file = '' ] + Property [ protected int $line = 0 ] } - Methods [10] { @@ -46,6 +46,7 @@ Extension [ extension #103 xlswriter version 1.5.2 ] { - Parameters [0] { } + - Tentative return [ void ] } Method [ final public method getMessage ] { @@ -195,7 +196,7 @@ Extension [ extension #103 xlswriter version 1.5.2 ] { Property [ private $read_row_type = NULL ] } - - Methods [50] { + - Methods [51] { Method [ public method __construct ] { - Parameters [1] { @@ -490,6 +491,13 @@ Extension [ extension #103 xlswriter version 1.5.2 ] { } } + Method [ public method setPrintScale ] { + + - Parameters [1] { + Parameter #0 [ $scale = ] + } + } + Method [ public method setCurrentSheetHide ] { - Parameters [0] { @@ -667,7 +675,7 @@ Extension [ extension #103 xlswriter version 1.5.2 ] { - Properties [0] { } - - Methods [15] { + - Methods [18] { Method [ public method __construct ] { - Parameters [1] { @@ -700,6 +708,33 @@ Extension [ extension #103 xlswriter version 1.5.2 ] { } } + Method [ public method borderOfTheFourSides ] { + + - Parameters [4] { + Parameter #0 [ $top ] + Parameter #1 [ $right ] + Parameter #2 [ $bottom ] + Parameter #3 [ $left ] + } + } + + Method [ public method borderColor ] { + + - Parameters [1] { + Parameter #0 [ $color ] + } + } + + Method [ public method borderColorOfTheFourSides ] { + + - Parameters [4] { + Parameter #0 [ $top_color ] + Parameter #1 [ $right_color ] + Parameter #2 [ $bottom_color ] + Parameter #3 [ $left_color ] + } + } + Method [ public method align ] { - Parameters [1] { diff --git a/php-pecl-xlswriter.spec b/php-pecl-xlswriter.spec index f907383..decd55b 100644 --- a/php-pecl-xlswriter.spec +++ b/php-pecl-xlswriter.spec @@ -1,7 +1,7 @@ # remirepo spec file for php-pecl-xlswriter # -# Copyright (c) 2018-2022 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2018-2023 Remi Collet +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries @@ -29,13 +29,13 @@ Summary: An efficient and fast xlsx file extension Name: %{?scl_prefix}php-pecl-%{pecl_name} -Version: 1.5.2 -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License: BSD +Version: 1.5.3 +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License: BSD-2-Clause URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz -Patch0: %{pecl_name}-php82.patch +Patch0: 0001-Another-fix-for-PACKED-array-on-PHP-8.2.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: make @@ -107,7 +107,7 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -%patch0 -p1 -b .pr451 +%patch0 -p1 -b .pr470 %if %{with syslib} # we use the system libraries @@ -210,15 +210,6 @@ OPT="-q -P --show-diff" OPT="$OPT %{?_smp_mflags}" %endif -%if %{with syslib} -# https://github.com/brechtsanders/xlsxio/issues/75 -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 %{__php} --no-php-ini \ @@ -264,6 +255,12 @@ cd .. %changelog +* Wed Mar 1 2023 Remi Collet - 1.5.3-1 +- update to 1.5.3 +- drop patch merged upstream +- add another patch for PHP 8.2 from + https://github.com/viest/php-ext-xlswriter/pull/470 + * Fri Sep 16 2022 Remi Collet - 1.5.2-2 - add patch for PHP 8.2 from https://github.com/viest/php-ext-xlswriter/pull/451 diff --git a/xlswriter-php82.patch b/xlswriter-php82.patch deleted file mode 100644 index 912beda..0000000 --- a/xlswriter-php82.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 5ec02a705d9171150035b028af622f913088ff7f Mon Sep 17 00:00:00 2001 -From: Remi Collet -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(); -- cgit