Skip to content

Commit 96e843c

Browse files
Jan-Simon WinkelmannPowerKiKi
authored andcommitted
Prevent notice during accessing "cached magnification factor" offset
Sheet View Settings Block should be 8-14 bytes long in BIFF8 Excel 97 according to the open office file format documentation. However access to byte 10 and 12 is not possible when record data is malformed, so getUInt2d throws notice.
1 parent 92389c7 commit 96e843c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2626
### Fixed
2727

2828
- Ensure that the list of shared formulae is maintained when an xlsx file is chunked with readFilter[Issue #169](https://github.com/PHPOffice/PhpSpreadsheet/issues/1669).
29+
- Fix for notice during accessing "cached magnification factor" offset [#1354](https://github.com/PHPOffice/PhpSpreadsheet/pull/1354)
2930

3031
## 1.15.0 - 2020-10-11
3132

src/PhpSpreadsheet/Reader/Xls.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4377,11 +4377,22 @@ private function readWindow2(): void
43774377
// offset: 10; size: 2; cached magnification factor in page break preview (in percent); 0 = Default (60%)
43784378
// offset: 12; size: 2; cached magnification factor in normal view (in percent); 0 = Default (100%)
43794379
// offset: 14; size: 4; not used
4380-
$zoomscaleInPageBreakPreview = self::getUInt2d($recordData, 10);
4380+
if (!isset($recordData[10])) {
4381+
$zoomscaleInPageBreakPreview = 0;
4382+
} else {
4383+
$zoomscaleInPageBreakPreview = self::getUInt2d($recordData, 10);
4384+
}
4385+
43814386
if ($zoomscaleInPageBreakPreview === 0) {
43824387
$zoomscaleInPageBreakPreview = 60;
43834388
}
4384-
$zoomscaleInNormalView = self::getUInt2d($recordData, 12);
4389+
4390+
if (!isset($recordData[12])) {
4391+
$zoomscaleInNormalView = 0;
4392+
} else {
4393+
$zoomscaleInNormalView = self::getUInt2d($recordData, 12);
4394+
}
4395+
43854396
if ($zoomscaleInNormalView === 0) {
43864397
$zoomscaleInNormalView = 100;
43874398
}

0 commit comments

Comments
 (0)