Skip to content

Commit 66ca9ea

Browse files
committed
Merge remote-tracking branch 'origin' into dev
2 parents 5aebad7 + 3ec96b1 commit 66ca9ea

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

include/xlswriter.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ static inline chart_object *php_vtiful_chart_fetch_object(zend_object *obj) {
185185
#define lxw_snprintf __builtin_snprintf
186186
#endif
187187

188+
#if PHP_VERSION_ID < 80000
189+
#define PROP_OBJ(zv) (zv)
190+
#else
191+
#define PROP_OBJ(zv) Z_OBJ_P(zv)
192+
#endif
193+
194+
188195
lxw_format * zval_get_format(zval *handle);
189196
xls_resource_write_t * zval_get_resource(zval *handle);
190197
xls_resource_chart_t * zval_get_chart(zval *resource);

kernel/excel.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ PHP_METHOD(vtiful_xls, fileName)
305305

306306
ZVAL_COPY(return_value, getThis());
307307

308-
GET_CONFIG_PATH(dir_path, vtiful_xls_ce, return_value);
308+
GET_CONFIG_PATH(dir_path, vtiful_xls_ce, PROP_OBJ(return_value));
309309

310310
if(directory_exists(ZSTR_VAL(Z_STR_P(dir_path))) == XLSWRITER_FALSE) {
311311
zend_throw_exception(vtiful_exception_ce, "Configure 'path' directory does not exist", 121);
@@ -436,7 +436,7 @@ PHP_METHOD(vtiful_xls, constMemory)
436436

437437
ZVAL_COPY(return_value, getThis());
438438

439-
GET_CONFIG_PATH(dir_path, vtiful_xls_ce, return_value);
439+
GET_CONFIG_PATH(dir_path, vtiful_xls_ce, PROP_OBJ(return_value));
440440

441441
xls_object *obj = Z_XLS_P(getThis());
442442

@@ -532,7 +532,7 @@ PHP_METHOD(vtiful_xls, output)
532532
{
533533
zval rv, *file_path = NULL;
534534

535-
file_path = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_FIL), 0, &rv TSRMLS_DC);
535+
file_path = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_FIL), 0, &rv TSRMLS_DC);
536536

537537
xls_object *obj = Z_XLS_P(getThis());
538538

@@ -1093,7 +1093,7 @@ PHP_METHOD(vtiful_xls, openFile)
10931093

10941094
ZVAL_COPY(return_value, getThis());
10951095

1096-
GET_CONFIG_PATH(zv_config_path, vtiful_xls_ce, return_value);
1096+
GET_CONFIG_PATH(zv_config_path, vtiful_xls_ce, PROP_OBJ(return_value));
10971097

10981098
xls_object* obj = Z_XLS_P(getThis());
10991099

@@ -1231,7 +1231,7 @@ PHP_METHOD(vtiful_xls, putCSV)
12311231
RETURN_FALSE;
12321232
}
12331233

1234-
zv_type = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
1234+
zv_type = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
12351235

12361236
if (xlsx_to_csv(
12371237
fp, delimiter_str, delimiter_str_len, enclosure_str, enclosure_str_len, escape_str, escape_str_len,
@@ -1269,7 +1269,7 @@ PHP_METHOD(vtiful_xls, putCSVCallback)
12691269
RETURN_FALSE;
12701270
}
12711271

1272-
zv_type = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
1272+
zv_type = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
12731273

12741274
if (xlsx_to_csv(
12751275
fp, delimiter_str, delimiter_str_len, enclosure_str, enclosure_str_len, escape_str, escape_str_len,
@@ -1292,7 +1292,7 @@ PHP_METHOD(vtiful_xls, getSheetData)
12921292
RETURN_FALSE;
12931293
}
12941294

1295-
zval *zv_type = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
1295+
zval *zv_type = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
12961296

12971297
if (zv_type != NULL && Z_TYPE_P(zv_type) == IS_ARRAY) {
12981298
load_sheet_all_data(obj->read_ptr.sheet_t, zv_type, obj->read_ptr.data_type_default, return_value);
@@ -1322,7 +1322,7 @@ PHP_METHOD(vtiful_xls, nextRow)
13221322
}
13231323

13241324
if (zv_type_t == NULL) {
1325-
zv_type_t = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
1325+
zv_type_t = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
13261326
}
13271327

13281328
load_sheet_current_row_data(obj->read_ptr.sheet_t, return_value, zv_type_t, obj->read_ptr.data_type_default, READ_ROW);
@@ -1352,7 +1352,7 @@ PHP_METHOD(vtiful_xls, nextCellCallback)
13521352
xls_read_callback_data callback_data;
13531353

13541354
callback_data.data_type_default = obj->read_ptr.data_type_default;
1355-
callback_data.zv_type_t = zend_read_property(vtiful_xls_ce, getThis(), ZEND_STRL(V_XLS_TYPE), 0, NULL);
1355+
callback_data.zv_type_t = zend_read_property(vtiful_xls_ce, PROP_OBJ(getThis()), ZEND_STRL(V_XLS_TYPE), 0, NULL);
13561356

13571357
callback_data.fci = &fci;
13581358
callback_data.fci_cache = &fci_cache;

tests/merge_cell_type_writer.phpt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
--TEST--
22
Check for vtiful presence
33
--SKIPIF--
4-
<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
4+
<?php
5+
require __DIR__ . '/include/skipif.inc';
6+
skip_disable_reader();
7+
?>
58
--FILE--
69
<?php
710
$config = ['path' => './tests'];
@@ -40,4 +43,4 @@ array(3) {
4043
[0]=>
4144
float(3.001)
4245
}
43-
}
46+
}

0 commit comments

Comments
 (0)