From d4fda28168c659f7308036f34962f4fc26e398c3 Mon Sep 17 00:00:00 2001 From: Jan-Simon Winkelmann Date: Mon, 21 Sep 2020 18:16:17 +0200 Subject: [PATCH] Prevent notice during accessing "cached magnification factor" offset --- CHANGELOG.md | 3 ++- src/PhpSpreadsheet/Reader/Xls.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5e4e5b90a..ea887b05aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org). ### Fixed -- PrintArea causes exception [#1544](https://github.com/phpoffice/phpspreadsheet/pull/1544) +- PrintArea causes exception [#1544](https://github.com/phpoffice/phpspreadsheet/pull/1544) +- Fix for notice during accessing "cached magnification factor" offset [#1354](https://github.com/PHPOffice/PhpSpreadsheet/pull/1354) ## 1.14.1 - 2020-07-19 diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index 81cc5b2eda..fa5c49900f 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -4377,13 +4377,20 @@ private function readWindow2(): void // offset: 10; size: 2; cached magnification factor in page break preview (in percent); 0 = Default (60%) // offset: 12; size: 2; cached magnification factor in normal view (in percent); 0 = Default (100%) // offset: 14; size: 4; not used - $zoomscaleInPageBreakPreview = self::getUInt2d($recordData, 10); + if(!isset($recordData[10])){ + $zoomscaleInPageBreakPreview = 0; + }else{ + $zoomscaleInPageBreakPreview = self::getUInt2d($recordData, 10); + } + if ($zoomscaleInPageBreakPreview === 0) { $zoomscaleInPageBreakPreview = 60; } - $zoomscaleInNormalView = self::getUInt2d($recordData, 12); - if ($zoomscaleInNormalView === 0) { - $zoomscaleInNormalView = 100; + + if(!isset($recordData[12])){ + $zoomscaleInNormalView = 0; + }else{ + $zoomscaleInNormalView = self::getUInt2d($recordData, 12); } }