Skip to content

Commit

Permalink
Merge pull request #338 from ScottHuangZL/patch-1
Browse files Browse the repository at this point in the history
Add catch error to avoid 'Closure object cannot have properties' issue
  • Loading branch information
kartik-v authored Jul 8, 2021
2 parents 7c0a391 + 23b6ac2 commit 643f7d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ExportMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,14 @@ public function generateRow($model, $key, $index)
if (is_callable($contentOptions)) {
$contentOptions = $contentOptions($model, $key, $index, $column);
}
$format = ArrayHelper::getValue($contentOptions, 'cellFormat', null);

//20201026 Scott: To avoid 'Closure object cannot have properties' error
try {
$format = ArrayHelper::getValue($column->contentOptions, 'cellFormat', null);
} catch (\Error $e) {
$format = null;
}

$cell = $this->setOutCellValue(
$this->_objWorksheet,
self::columnName($this->_endCol) . ($index + $this->_beginRow + 1),
Expand Down

0 comments on commit 643f7d4

Please sign in to comment.