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

Check if $header and $footer are not null #4099

Closed
vpecinka opened this issue Jul 18, 2024 · 0 comments · Fixed by #4101
Closed

Check if $header and $footer are not null #4099

vpecinka opened this issue Jul 18, 2024 · 0 comments · Fixed by #4101

Comments

@vpecinka
Copy link

Hi,

I found the following problem in the Nextcloud project, where this code is used in Forms appliaction. It crashes for me because $header and $footer variables are null.

I sugest to fix the code with isset() test here:

The safe code should look like: $headerProperties = isset($header) ? $header->getElementsByTagNameNS($this->stylesNs, 'header-footer-properties')[0] : null;

oleibman added a commit to oleibman/PhpSpreadsheet that referenced this issue Jul 18, 2024
Fix PHPOffice#4099. Ods Reader was expecting there to always be `header-style` and `footer-style` tags when `page-layout` tag is present, but these need not exist. It seemed like there might be other exposures along this line in `readPageSettingStyles`; rather than waiting for a problem report to show up for each, the code is updated to use `->item(0)` in place of `[0]` when appropriate, and make use of the nullsafe `?->` operator introduced with Php8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant