PhpSpreadsheet: xls file cause the exception during open by Xls reader
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)
What is the expected behavior?
Excel file opened for reading/write I tried to use deprecated PhpExcel classes and the file opens successfully!
What is the current behavior?
Trying to open test excel file cause the exception:
Fatal error: Uncaught PhpOffice\PhpSpreadsheet\Reader\Exception: Parameter data is empty. in /home/.../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php:331 Stack trace: #0 /home/.../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php(281): PhpOffice\PhpSpreadsheet\Shared\OLERead::getInt4d('\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...', 116) #1 /home/.../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php(187): PhpOffice\PhpSpreadsheet\Shared\OLERead->readPropertySets() #2 /home/.../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php(1363): PhpOffice\PhpSpreadsheet\Shared\OLERead->read('/tmp/phpk3bjPS') #3 /home/.../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php(628): PhpOffice\PhpSpreadsheet\Reader\ in /home/.../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/OLERead.php on line 331
What are the steps to reproduce?
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
<?php
require __DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
$spreadsheet = $reader->load($_FILES['EXP_FILE']['tmp_name']);
var_dump($spreadsheet->getSheet(0)->getCell('A1')->getValue());die;
Which versions of PhpSpreadsheet and PHP are affected?
PhpSpreadsheet 1.1 php 7.1
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 27 (6 by maintainers)
Commits related to this issue
- xls file cause the exception during open by Xls reader #402 ignore some exception in property stream — committed to gurrumpalad/PhpSpreadsheet by deleted user 6 years ago
- Bugfix for issue: xls file cause the exception during open by Xls reader #402 revert commit 4b4831be07249743364a7335178fb44b4b3eeca7 with adding exceptions — committed to gurrumpalad/PhpSpreadsheet by deleted user 6 years ago
- Bugfix for issue: xls file cause the exception during open by Xls reader #402 adding unit tests for OLERead and Reader\Xls, also adding changelog entry — committed to gurrumpalad/PhpSpreadsheet by deleted user 6 years ago
- Bugfix for issue: xls file cause the exception during open by Xls reader #402 codestyle fixes — committed to gurrumpalad/PhpSpreadsheet by deleted user 6 years ago
This file was generated 3rd party software (Scanlister). I understand this file may have mistakes in structure, but LibreOffice, OpenOffice, MS Office opened this files without any errors. I think such files should be supported by PhpSpreadsheet also.
@GianinaSalomo thanks for reporting back. Maybe you could create a separate issue, linking to this one, with more details about the warnings ?
I have the same bug. Here, a fix, that help me: