Skip to content

Commit

Permalink
Merge pull request #38 from Ticketpark/bugfix/json-exception
Browse files Browse the repository at this point in the history
Ignore invalid _excel-styles
  • Loading branch information
sprain authored Nov 9, 2023
2 parents 43b38ab + cbc2d9e commit 5a910b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/HtmlPhpExcel/HtmlPhpExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ private function getStyles(HtmlPhpExcelElement\Element $documentElement): array
$styles = [];
if ($attributeStyles = $documentElement->getAttribute('_excel-styles')) {
if (!is_array($attributeStyles)) {
$decodedJson = json_decode($attributeStyles, true, 512, JSON_THROW_ON_ERROR);
if (null !== $decodedJson) {
$attributeStyles = $decodedJson;
try {
$attributeStyles = json_decode($attributeStyles, true, 512, JSON_THROW_ON_ERROR);
} catch (\JsonException) {
}
}
}
Expand Down

0 comments on commit 5a910b2

Please sign in to comment.