summaryrefslogtreecommitdiffstats
path: root/xlswriter-php8.patch
blob: b50fd3ccfb0e0340f0b5fea6b6916fb47dfb4eff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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;