Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to access array offset on value of type null (Xls Reader) #2315

Closed
hannanyusop opened this issue Oct 5, 2021 · 4 comments
Closed

Comments

@hannanyusop
Copy link

hannanyusop commented Oct 5, 2021

This is:

- [/] 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?

Phpspread can read the xls file

What is the current behavior?

error
"class": "ErrorException",
"message": "Trying to access array offset on value of type null",
"code": 0,
"file": ...//vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php:7015",

for now im using below code to keep my system running.

$data = $this->externalNames[$index - 1]['name'] ?? "";

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';

$spreadsheet = $reader->load($file);
 $writer    = new \PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet);
 $writer->save('test.xls');

?>





### Which versions of PhpSpreadsheet and PHP are affected?
[CIMB BizConverter.xls](https://github.com/PHPOffice/PhpSpreadsheet/files/7286322/CIMB.BizConverter.xls)
@oleibman
Copy link
Collaborator

This issue is nominally solved by PR #2312. However, that PR is not yet in a state where it can be merged.

@hannanyusop
Copy link
Author

ETA to being merge into master? Tqq in advance

@oleibman
Copy link
Collaborator

As mentioned, I cannot merge your PR as it stands now. It needs to show 1 module changed, not 97.

oleibman added a commit to oleibman/PhpSpreadsheet that referenced this issue Oct 16, 2021
See issue PHPOffice#2315. It is nominally solved by PR PHPOffice#2312, but that PR is completely unsuitable for merging. This one-line change is a replacement for that PR.

As with many problems of this type, it is not clear how how to create a spreadsheet with this sort of harmless corruption in the wild. An example was supplied with the issue, and I have tested manually against it. However, the file is huge and not suitable for a formal unit test. I do not understand BIFF well enough to try and craft a suitable example on my own.
oleibman added a commit that referenced this issue Nov 2, 2021
See issue #2315. It is nominally solved by PR #2312, but that PR is completely unsuitable for merging. This one-line change is a replacement for that PR.

As with many problems of this type, it is not clear how how to create a spreadsheet with this sort of harmless corruption in the wild. An example was supplied with the issue, and I have tested manually against it. However, the file is huge and not suitable for a formal unit test. I do not understand BIFF well enough to try and craft a suitable example on my own.

Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
@PowerKiKi
Copy link
Member

Fixed via ca5bd9b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants