From bebfb1e41a770de8033dc37affac72c3d7ceda6d Mon Sep 17 00:00:00 2001 From: AegirLeet <33277331+AegirLeet@users.noreply.github.com> Date: Sun, 19 Aug 2018 08:43:54 +0200 Subject: [PATCH] Fix warning when reading xlsx without styles Fixes https://github.com/PHPOffice/PHPExcel/issues/1134 Fixes #631 --- CHANGELOG.md | 1 + src/PhpSpreadsheet/Reader/Xlsx.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b8518d5..85f3e7d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Allow iterators to go out of bounds with prev - [#587](https://github.com/PHPOffice/PhpSpreadsheet/issues/587) +- Fix warning when reading xlsx without styles - [#631](https://github.com/PHPOffice/PhpSpreadsheet/pull/631) ## [1.4.0] - 2018-08-06 diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index c6e8512d..a7709852 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -643,7 +643,7 @@ class Xlsx extends BaseReader $excel->addCellXf($objStyle); } - foreach ($xmlStyles->cellStyleXfs->xf as $xf) { + foreach (isset($xmlStyles->cellStyleXfs->xf) ? $xmlStyles->cellStyleXfs->xf : [] as $xf) { $numFmt = NumberFormat::FORMAT_GENERAL; if ($numFmts && $xf['numFmtId']) { $tmpNumFmt = self::getArrayItem($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]"));