summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-09-02 10:45:57 +0200
committerRemi Collet <remi@remirepo.net>2020-09-02 10:45:57 +0200
commit685b9490ac25d03456f7ed626280000a29a97e7e (patch)
tree442b23769ccfe2656f51d71372686665114efc36
parent709dd649ecaefa3f7e859b443b710d35ec54b0c1 (diff)
add patch for PHP 8.0.0beta3 from
https://github.com/viest/php-ext-xlswriter/pull/298
-rw-r--r--php-pecl-xlswriter.spec14
-rw-r--r--xlswriter-php8.patch113
2 files changed, 124 insertions, 3 deletions
diff --git a/php-pecl-xlswriter.spec b/php-pecl-xlswriter.spec
index 84b068d..663f9a2 100644
--- a/php-pecl-xlswriter.spec
+++ b/php-pecl-xlswriter.spec
@@ -28,11 +28,14 @@
Summary: An efficient and fast xlsx file export extension
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: 1.3.6
-Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 6%{?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
+# from https://github.com/viest/php-ext-xlswriter/pull/298
+Patch0: xlswriter-php8.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7
BuildRequires: %{?scl_prefix}php-pear
@@ -105,6 +108,7 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .pr
# we use the system libraries
rm -r library
@@ -209,7 +213,7 @@ cd NTS
%{__php} --no-php-ini \
$modules \
--define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
- --modules | grep %{pecl_name}
+ --modules | grep ^%{pecl_name}
%if %{with_tests}
: Upstream test suite for NTS extension
@@ -226,7 +230,7 @@ cd ../ZTS
%{__ztsphp} --no-php-ini \
$modules \
--define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
- --modules | grep %{pecl_name}
+ --modules | ^grep %{pecl_name}
%if %{with_tests}
: Upstream test suite for ZTS extension
@@ -255,6 +259,10 @@ cd ..
%changelog
+* Wed Sep 2 2020 Remi Collet <remi@remirepo.net> - 1.3.6-6
+- add patch for PHP 8.0.0beta3 from
+ https://github.com/viest/php-ext-xlswriter/pull/298
+
* Tue Aug 18 2020 Remi Collet <remi@remirepo.net> - 1.3.6-5
- build using libxlsxwriter version 0.9.9
diff --git a/xlswriter-php8.patch b/xlswriter-php8.patch
new file mode 100644
index 0000000..b50fd3c
--- /dev/null
+++ b/xlswriter-php8.patch
@@ -0,0 +1,113 @@
+diff -up ./include/xlswriter.h.old ./include/xlswriter.h
+--- ./include/xlswriter.h.old 2020-09-02 10:37:59.430350020 +0200
++++ ./include/xlswriter.h 2020-09-02 10:38:03.129338838 +0200
+@@ -183,6 +183,13 @@ static inline chart_object *php_vtiful_c
+ #define lxw_snprintf __builtin_snprintf
+ #endif
+
++#if PHP_VERSION_ID < 80000
++#define PROP_OBJ(zv) (zv)
++#else
++#define PROP_OBJ(zv) Z_OBJ_P(zv)
++#endif
++
++
+ lxw_format * zval_get_format(zval *handle);
+ xls_resource_write_t * zval_get_resource(zval *handle);
+ xls_resource_chart_t * zval_get_chart(zval *resource);
+diff -up ./kernel/common.c.old ./kernel/common.c
+--- ./kernel/common.c.old 2020-09-02 10:37:41.143405296 +0200
++++ ./kernel/common.c 2020-09-02 10:37:47.040387471 +0200
+@@ -57,7 +57,7 @@ void call_object_method(zval *object, co
+ zval z_f_name;
+
+ ZVAL_STRINGL(&z_f_name, function_name, strlen(function_name));
+- call_user_function_ex(NULL, object, &z_f_name, ret_val, param_count, params, 0, NULL);
++ call_user_function(NULL, object, &z_f_name, ret_val, param_count, params);
+
+ if (Z_ISUNDEF_P(ret_val)) {
+ ZVAL_NULL(ret_val);
+diff -up ./kernel/excel.c.old ./kernel/excel.c
+--- ./kernel/excel.c.old 2020-09-02 10:38:16.686297857 +0200
++++ ./kernel/excel.c 2020-09-02 10:38:21.573283085 +0200
+@@ -297,7 +297,7 @@ PHP_METHOD(vtiful_xls, fileName)
+
+ ZVAL_COPY(return_value, getThis());
+
+- GET_CONFIG_PATH(dir_path, vtiful_xls_ce, return_value);
++ GET_CONFIG_PATH(dir_path, vtiful_xls_ce, PROP_OBJ(return_value));
+
+ if(directory_exists(ZSTR_VAL(Z_STR_P(dir_path))) == XLSWRITER_FALSE) {
+ zend_throw_exception(vtiful_exception_ce, "Configure 'path' directory does not exist", 121);
+@@ -423,7 +423,7 @@ PHP_METHOD(vtiful_xls, constMemory)
+
+ ZVAL_COPY(return_value, getThis());
+
+- GET_CONFIG_PATH(dir_path, vtiful_xls_ce, return_value);
++ GET_CONFIG_PATH(dir_path, vtiful_xls_ce, PROP_OBJ(return_value));
+
+ xls_object *obj = Z_XLS_P(getThis());
+
+@@ -515,7 +515,7 @@ PHP_METHOD(vtiful_xls, output)
+ {
+ zval rv, *file_path = NULL;
+
+- file_path = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_FIL), 0, &rv TSRMLS_DC);
++ file_path = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_FIL), 0, &rv TSRMLS_DC);
+
+ xls_object *obj = Z_XLS_P(getThis());
+
+@@ -1066,7 +1066,7 @@ PHP_METHOD(vtiful_xls, openFile)
+
+ ZVAL_COPY(return_value, getThis());
+
+- GET_CONFIG_PATH(zv_config_path, vtiful_xls_ce, return_value);
++ GET_CONFIG_PATH(zv_config_path, vtiful_xls_ce, PROP_OBJ(return_value));
+
+ xls_object* obj = Z_XLS_P(getThis());
+
+@@ -1177,7 +1177,7 @@ PHP_METHOD(vtiful_xls, putCSV)
+ RETURN_FALSE;
+ }
+
+- zv_type = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
++ zv_type = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
+
+ if (xlsx_to_csv(
+ fp, delimiter_str, delimiter_str_len, enclosure_str, enclosure_str_len, escape_str, escape_str_len,
+@@ -1215,7 +1215,7 @@ PHP_METHOD(vtiful_xls, putCSVCallback)
+ RETURN_FALSE;
+ }
+
+- zv_type = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
++ zv_type = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
+
+ if (xlsx_to_csv(
+ fp, delimiter_str, delimiter_str_len, enclosure_str, enclosure_str_len, escape_str, escape_str_len,
+@@ -1238,7 +1238,7 @@ PHP_METHOD(vtiful_xls, getSheetData)
+ RETURN_FALSE;
+ }
+
+- zval *zv_type = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
++ zval *zv_type = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
+
+ if (zv_type != NULL && Z_TYPE_P(zv_type) == IS_ARRAY) {
+ load_sheet_all_data(obj->read_ptr.sheet_t, zv_type, return_value);
+@@ -1268,7 +1268,7 @@ PHP_METHOD(vtiful_xls, nextRow)
+ }
+
+ if (zv_type_t == NULL) {
+- zv_type_t = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
++ zv_type_t = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
+ }
+
+ load_sheet_current_row_data(obj->read_ptr.sheet_t, return_value, zv_type_t, READ_ROW);
+@@ -1297,7 +1297,7 @@ PHP_METHOD(vtiful_xls, nextCellCallback)
+
+ xls_read_callback_data callback_data;
+
+- callback_data.zv_type_t = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
++ callback_data.zv_type_t = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
+
+ callback_data.fci = &fci;
+ callback_data.fci_cache = &fci_cache;