Closed
Description
This is:
- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
I came across this issue while I was writing tests with loading several spreadsheets and some datetime values was clearly invalid.
What is the expected behavior?
Loading numerious xlsx files should not share global state. Problematic is \PhpOffice\PhpSpreadsheet\Shared\Date::$excelCalendar
Problematic code https://github.com/PHPOffice/PhpSpreadsheet/blob/master/src/PhpSpreadsheet/Reader/Xlsx.php#L662
What is the current behavior?
\PhpOffice\PhpSpreadsheet\Shared\Date::$excelCalendar configuration can be shared across multiple spreadsheets
What are the steps to reproduce?
<?php
include 'vendor/autoload.php';
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
// this method call config global value of \PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar
$reader->load(/* load file with set $xmlWorkbook->workbookPr and with workbookPr['date1904'] */);
// second load of another spreadsheet can be problematic if spreadsheet doesnt have "workbookPr" element. Then
// previously configurated global value of \PhpOffice\PhpSpreadsheet\Shared\Date::$excelCalendar is used
$reader->load(/* load file with missing $xmlWorkbook->workbookPr */);
working example with testing data can be found on gist
Which versions of PhpSpreadsheet and PHP are affected?
1.7.0
but referenced code is 3-4 years old so it could be many versions
Metadata
Metadata
Assignees
Labels
No labels