Skip to content

Error loading Xls file with empty documentSummaryInformation #1882

@sebluy

Description

@sebluy

This is:

- [ x] a bug report
- [ ] a feature request
- [ ] **not** a usage question

What is the expected behavior?

The Excel file should load.

What is the current behavior?

I'm getting the following error:

PHP Error[8]: Uninitialized string offset: 27
in file .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php at line 7959
#0 .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php(1538): getInt4d()
#1 .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php(645): PhpOffice\PhpSpreadsheet\Reader\Xls->readDocumentSummaryInformation()
PhpOffice\PhpSpreadsheet\Reader\Xls->load()

What are the steps to reproduce?

I'm not sure how to reproduce this one. When the code gets to readDocumentSummaryInformation(), the stream is empty but not null, and the code crashes. The problem only happens when I try to open certain files. The files open fine in LibreOffice, and if I re-save them using LibreOffice, then they open fine with PhpSpreadsheet. I'm not sure if this is necessarily a bug, or if the files I'm using are somehow corrupt. The files contain sensitive information so I can't upload them. Regardless, I thought I'd post this here in case it is a bug.

Which versions of PhpSpreadsheet and PHP are affected?

Tested on PHP 7.2.24, and PhpSpreadsheet 1.16 and 1.11.

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