Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-E committed Nov 13, 2020
1 parent 294e18a commit c874837
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[2017-??-??] - Version 1.0.3dev
[2018-??-??] - Version 1.0.3dev
* Fixed crash when trying to read an empty file
* Fixed bug with writing references (see issue #234)
* Added PECL package.xml to allow installation via pecl
* Added ExcelSheet::AS_STRING const to use with write operations (see PR 183 by ederuiter)
* Added new methods (requires LibXL 3.8.0)
Expand Down
18 changes: 7 additions & 11 deletions excel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2366,14 +2366,14 @@ zend_bool php_excel_write_cell(SheetHandle sheet, BookHandle book, int row, int
{
zend_string *data_zs;

try_again:
switch (Z_TYPE_P(data)) {
case IS_NULL:
if (INI_INT("excel.skip_empty") > 0) {
return 1;
}
if (!format) {
FormatHandle fmt = xlBookAddFormat(book, NULL);
return xlSheetWriteBlank(sheet, row, col, fmt);
return xlSheetWriteBlank(sheet, row, col, NULL);
} else {
return xlSheetWriteBlank(sheet, row, col, format);
}
Expand Down Expand Up @@ -2433,16 +2433,12 @@ zend_bool php_excel_write_cell(SheetHandle sheet, BookHandle book, int row, int
case IS_FALSE:
return xlSheetWriteBool(sheet, row, col, 0, format);

case IS_ARRAY:
php_error_docref(NULL, E_WARNING, "Type mismatch: array not supported for atomic write operation in row %d, column %d", row, col);
return 1;

case IS_OBJECT:
php_error_docref(NULL, E_WARNING, "Type mismatch: object not supported for atomic write operation in row %d, column %d", row, col);
return 1;
case IS_REFERENCE:
ZVAL_DEREF(data);
goto try_again;

case IS_RESOURCE:
php_error_docref(NULL, E_WARNING, "Type mismatch: resource not supported for atomic write operation in row %d, column %d", row, col);
default:
php_error_docref(NULL, E_WARNING, "Type mismatch: %s not supported for atomic write operation in row %d, column %d", Z_TYPE_P(data), row, col);
return 1;
}

Expand Down

0 comments on commit c874837

Please sign in to comment.