This is a bug report
What is the expected behavior?
Read a simple XLSX file (no formula inside) without exception
What is the current behavior?
The XLSX reader crashes with the message
PhpOffice\PhpSpreadsheet\Exception : You must specify a worksheet or a scope for a Named Range
/home/vagrant/code/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/NamedRange.php:21
/home/vagrant/code/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/DefinedName.php:97
/home/vagrant/code/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:1398
What are the steps to reproduce?
// This works properly, file is open
$reader = new Xls();
$reader->load(storage_path('default.xls'));
// This fails to open with the above exception
$reader = new Xlsx();
$reader->load(storage_path('default.xlsx'));
test.zip
The above zip file contains the XLS and XLSX files that exhibit the behaviour. The XLS file is simply the XLSX file saved as XLS (no change in the spreadsheet itself).
Which versions of PhpSpreadsheet and PHP are affected?
Package 1.15.0
PHP 7.4