Skip to content
New issue

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

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

Already on GitHub? # to your account

ErrorException: Undefined property: DOMDocument::$firstElementChild #24

Closed
skdaxina4 opened this issue Jan 15, 2025 · 3 comments
Closed

Comments

@skdaxina4
Copy link

skdaxina4 commented Jan 15, 2025

I am facing this error on PHP 7.4, but it functions correctly on PHP 8.1. How can I make it work on PHP 7.4?

\\vendor\alexandrainst\php-xlsx-fast-editor\src\XlsxFastEditor.php:1017
Stack trace:
#0 E:\Wamp64\www\espark\starwood\starwood_api\vendor\alexandrainst\php-xlsx-fast-editor\src\XlsxFastEditor.php(1017): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined prope...', 'E:\\Wamp64\\www\\e...', 1017, Array)
#1 E:\Wamp64\www\espark\starwood\starwood_api\vendor\alexandrainst\php-xlsx-fast-editor\src\XlsxFastEditorCell.php(369): alexandrainst\XlsxFastEditor\XlsxFastEditor->_makeNewSharedString('testz testtt')
#2 E:\Wamp64\www\espark\starwood\starwood_api\vendor\alexandrainst\php-xlsx-fast-editor\src\XlsxFastEditor.php(1068): alexandrainst\XlsxFastEditor\XlsxFastEditorCell->writeString('testz testtt')
#3 E:\Wamp64\www\espark\starwood\starwood_api\app\Http\Controllers\API\ShutterMeasurementCutSheetController.php(592): alexandrainst\XlsxFastEditor\XlsxFastEditor->writeString(1, 'J3', 'testz testtt')
#4 E:\Wamp64\www\espark\starwood\starwood_api\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): App\Http\Controllers\API\ShutterMeasurementCutSheetController->cutsheetExcel('21')
@Alkarex
Copy link
Member

Alkarex commented Jan 15, 2025

Let me take a look

@Alkarex
Copy link
Member

Alkarex commented Jan 15, 2025

Right, as visible on https://www.php.net/class.domelement#domelement.props.firstelementchild

Version 8.0.0 The firstElementChild, lastElementChild, childElementCount, previousElementSibling, and nextElementSibling properties have been added

I was not aware of that, so the current code requires in fact PHP 8+.
But making a version compatible with PHP 7.4 would not be that difficult, but it would be a bit poorer: by changing all instances of firstElementChild to firstChild, etc.

Do you strongly need this library for PHP 7.4?

Alkarex added a commit that referenced this issue Jan 15, 2025
@skdaxina4
Copy link
Author

@Alkarex No worries, and thank you for your time. You've created a very helpful package!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants