Skip to content

Excel (.xlsx) parsing fails with an NPE #1172

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

Closed
serverdevil opened this issue Sep 24, 2019 · 2 comments
Closed

Excel (.xlsx) parsing fails with an NPE #1172

serverdevil opened this issue Sep 24, 2019 · 2 comments

Comments

@serverdevil
Copy link

This is:

- [x] a bug report
- [ ] a feature request

What is the expected behavior?

Workbook parsing should succeed

What is the current behavior?

Workbook parsing fails with following error

<b>Fatal error</b>:  Uncaught Error: Call to a member function attributes() on null in /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:1234
Stack trace:
#0 /var/www/html/NBUIExcelReader.php(60): PhpOffice\PhpSpreadsheet\Reader\Xlsx-&gt;load('/var/www/html/u...')
...
#3 {main}
  thrown in <b>/var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php</b> on line <b>1234</b><br />

What are the steps to reproduce?

Apologies for this but the issue is being noticed in a bunch of financial Excel files that I'm not at liberty to share.
Changing the erring code at line 1234 in Reader/Xlsx.php to the following works.

if (isset($clr->alpha)) {
     $shadow->setAlpha(self::getArrayItem($clr->alpha->attributes(), 'val') / 1000);
}

If it is acceptable to the team to address this based on this info, please do so. Otherwise, feel free to close the issue.

Which versions of PhpSpreadsheet and PHP are affected?

Reproducible in 1.9

@stale
Copy link

stale bot commented Nov 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Nov 23, 2019
@stale stale bot closed this as completed Nov 30, 2019
@oleibman
Copy link
Collaborator

I believe this was fixed by PR #2173 in June 2021.

@oleibman oleibman removed the stale label Sep 30, 2024
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

2 participants