From b20f5c1d1185b8e1ad27ef7638c434496ceb8179 Mon Sep 17 00:00:00 2001 From: Jerome3 Date: Tue, 1 Oct 2019 11:47:59 +0200 Subject: [PATCH] Fix ODS Reader when no DC namespace are defined ODS files without spreadsheet properties were triggering a fatal error Fixes #1047 Fixes #1176 Closes #1182 --- CHANGELOG.md | 1 + src/PhpSpreadsheet/Reader/Ods/Properties.php | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a80d3ed..b7c2ceff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Trying to remove a column that doesn't exist deletes the latest column - Keep big integer as integer instead of lossely casting to float [#874](https://github.com/PHPOffice/PhpSpreadsheet/pull/874) - Fix branch pruning handling of non boolean conditions [#1167](https://github.com/PHPOffice/PhpSpreadsheet/pull/1167) +- Fix ODS Reader when no DC namespace are defined [#1182](https://github.com/PHPOffice/PhpSpreadsheet/pull/1182) ## [1.9.0] - 2019-08-17 diff --git a/src/PhpSpreadsheet/Reader/Ods/Properties.php b/src/PhpSpreadsheet/Reader/Ods/Properties.php index 8b6122c5..4c87c2f5 100644 --- a/src/PhpSpreadsheet/Reader/Ods/Properties.php +++ b/src/PhpSpreadsheet/Reader/Ods/Properties.php @@ -20,11 +20,10 @@ class Properties $officeProperty = $xml->children($namespacesMeta['office']); foreach ($officeProperty as $officePropertyData) { /** @var \SimpleXMLElement $officePropertyData */ - $officePropertiesDC = (object) []; if (isset($namespacesMeta['dc'])) { $officePropertiesDC = $officePropertyData->children($namespacesMeta['dc']); + $this->setCoreProperties($docProps, $officePropertiesDC); } - $this->setCoreProperties($docProps, $officePropertiesDC); $officePropertyMeta = (object) []; if (isset($namespacesMeta['dc'])) {