fagzal

fagzal

Member Since 9 years ago

Lamp Stack Ltd., Dunakeszi, Hungary

0 organizations

Experience Points
1
follower
Lessons Completed
1
follow
Lessons Completed
15
stars
Best Reply Awards
10
repos

1 contributions in the last year

fagzal Most Used Languages
fagzal GitHub Stats

10 Pinned

⚡ SQL based DNS zone editor
⚡ Unified sample web app. The easy way to learn web frameworks.
⚡ Docker example 1
⚡ compose file
⚡ docker-tick-limited
⚡ Travis-CI test
Jun
11
1 week ago
Activity icon
issue

fagzal issue PHPOffice/PhpSpreadsheet

fagzal
fagzal

"Illegal offset type" when processing authorId in Xlsx.php - php8 compatibility issue?

This is:

- [x] a bug report
- [ ] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Compatibility with PHP8 / reading xlsx file without errors.

What is the current behavior?

After upgrading to PHP8.0.6, we started to get errors when reading xlsx files. Error happens in master,phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php, line 883:

$commentModel->setAuthor($authors[$comment['authorId']]);

Error reported is "Illegal offset type".

I have printed the value of $comment['authorId'], and it is:

SimpleXMLElement Object
(
    [0] => 1
)

I could do a workaround by using:

$commentModel->setAuthor($authors[(string)$comment['authorId']]);

I am not 100% sure this is PHP8 related, but it worked when we use PHP7.4.

What are the steps to reproduce?

Will provide if you cannot reproduce.

Which versions of PhpSpreadsheet and PHP are affected?

master