Skip to content

Uninitialized string offset in Xls.php #1592

@MatthiasKuehneEllerhold

Description

This is:

- [x] a bug report
- [ ] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Correct parsing of an XLS file. No errors / notices thrown. No running into the execution timeout.

What is the current behavior?

NOTICE (5): ErrorException: Uninitialized string offset: 2386 in /x/y/Logger.php:86
   1701 Stack trace:
   1702 #0 /x/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php(7886): \Logger::Log\{closure}(8, 'Uninitialized s...', '/var/...', 7886, Array)
   1703 #1 /x/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php(2981): PhpOffice\PhpSpreadsheet\Reader\Xls::getUInt2d('9\x02\x00\x009\x02\x00\x00\x12\x00\x00Plak...', 2386)
   1704 #2 /x/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php(727): PhpOffice\PhpSpreadsheet\Reader\Xls->readSst()
   1705 #3 /x/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php(86): PhpOffice\PhpSpreadsheet\Reader\Xls->load('/var/www/ellerh...')
   1706 #4 /Parser.php(32): PhpOffice\PhpSpreadsheet\IOFactory::load('/var/...')

(Same happened for offset 2387.)
The read took forever and was stopped after 30 seconds because of an execution timeout.

What are the steps to reproduce?

This error occured when an XLS file was read. I cant make the spreadsheet public, because it contains business data.
This is the first spreadsheet that exhibit this behaviour, all other spreadsheets from this source were correctly read & parsed.

We've got a hold of the XLS file. The process was that a generated XLS file was edited by hand in Office 365 and saved. The original generated file could be parsed without any problem, the edited file lead to this error.
Reopening the edited file in Excel 2016 and saving it (without any modification) fixed it and the parsing worked flawlessly.

Which versions of PhpSpreadsheet and PHP are affected?

phpoffice/phpspreadsheet: 1.13.0
PHP: 7.4.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions