Skip to content

Commit

Permalink
Fix uncaught exception when loading files with strange range defs [PH…
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Lademann committed Oct 24, 2020
1 parent cc209d0 commit f94b92c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).

- 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).
- Fix for notice during accessing "cached magnification factor" offset [#1354](https://github.com/PHPOffice/PhpSpreadsheet/pull/1354)
- Fix uncaught exception when loading files with strange range defs [#1686]

## 1.15.0 - 2020-10-11

Expand Down
12 changes: 11 additions & 1 deletion src/PhpSpreadsheet/Reader/Xlsx.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Cell\Hyperlink;
use PhpOffice\PhpSpreadsheet\DefinedName;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
use PhpOffice\PhpSpreadsheet\Reader\Security\XmlScanner;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\AutoFilter;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart;
Expand Down Expand Up @@ -1398,7 +1399,16 @@ public function load($pFilename)
$locatedSheet = $excel->getSheetByName($extractedSheetName);
}

$excel->addDefinedName(DefinedName::createInstance((string) $definedName['name'], $locatedSheet, $definedRange, false));
try {
$excel->addDefinedName(DefinedName::createInstance(
(string) $definedName['name'],
$locatedSheet,
$definedRange,
false
));
} catch (PhpSpreadsheetException $exception) {
continue;
}
}
}
}
Expand Down

0 comments on commit f94b92c

Please sign in to comment.