You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using PhpSpreadsheet in a Wordpress environment to offer custom functionality via Rest API.
Now I am having the situation, that one of my Wordpress Plugins uses the Dependency maennchen/zipstream-php in Version 2.2.6.
This leads to the following exception when trying to do the hello world example of PhpSpreadsheet:
[13-Feb-2025 17:55:08 UTC] PHP Fatal error: Uncaught TypeError: ZipStream\File::__construct(): Argument #1 ($fileName) must be of type string, ZipStream\ZipStream given, called in wp-content/plugins/filebird-pro/vendor/maennchen/zipstream-php/src/ZipStream.php on line 221 and defined in wp-content/plugins/signup/vendor/maennchen/zipstream-php/src/File.php:46
Stack trace:
#0 wp-content/plugins/filebird-pro/vendor/maennchen/zipstream-php/src/ZipStream.php(221): ZipStream\File->__construct(Object(ZipStream\ZipStream), '[Content_Types]...', Object(ZipStream\Option\File))
#1 wp-content/plugins/signup/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php(662): ZipStream\ZipStream->addFile('[Content_Types]...', '<?xml version="...')
#2 wp-content/plugins/signup/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php(669): PhpOffice\PhpSpreadsheet\Writer\Xlsx->addZipFile('[Content_Types]...', '<?xml version="...')
#3 wp-content/plugins/signup/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php(520): PhpOffice\PhpSpreadsheet\Writer\Xlsx->addZipFiles(Array)
#4 wp-content/themes/ww-w3k/inc/custom-signup.php(673): PhpOffice\PhpSpreadsheet\Writer\Xlsx->save('wp-content/sign...')
#5 wp-includes/rest-api/class-wp-rest-server.php(1292): generateExcelAthletes(Object(WP_REST_Request))
#6 wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/ww-signup/v1/g...', Array, NULL)
#7 wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch(Object(WP_REST_Request))
#8 wp-includes/rest-api.php(449): WP_REST_Server->serve_request('/ww-signup/v1/g...')
#9 wp-includes/class-wp-hook.php(324): rest_api_loaded(Object(WP))
#10 wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#11 wp-includes/plugin.php(565): WP_Hook->do_action(Array)
#12 wp-includes/class-wp.php(418): do_action_ref_array('parse_request', Array)
#13 wp-includes/class-wp.php(813): WP->parse_request('')
#14 wp-includes/functions.php(1336): WP->main('')
#15 wp-blog-header.php(16): wp()
#16 index.php(17): require('/home/httpd/vho...')
#17 {main}
thrown in wp-content/plugins/signup/vendor/maennchen/zipstream-php/src/File.php on line 46
From what I can tell after analyzing the situation, it seems that PhpSpreadsheet uses the dependency maennchen/zipstream-php from the Wordpress Plugin filebird-pro which as mentioned uses Version 2.2.6 instead of using the correct 3.x Version
As soon as I deactivate the Wordpress Plugin, everything works as expected. Sadly, deactivating it is not a real long term option.
I hav also tried explicitely requiring maennchen/zipstream-php in my Composer Json with a 3.x Version, this did also not help.
I have seen, that PhpSpreadsheet contains a switch to use either Zipstream 2 or 3. Is there maybe a bug in the init logic for Version 2?
The text was updated successfully, but these errors were encountered:
I have found a workaround:
By removing the folder maennchen/zipstream-php in my custom logic's vendor folder, it seems that PhpSpreadsheet gets forced to actually fully use the 2.x version of my wordpress plugin
@janwidmer I am thrilled that you found a solution. I am not a WordPress user and doubt that I could have helped much. Some of our active branches are locked to ZipStream 2 and some to ZipStream 3, so we are confident that each works in isolation (although manually clearing the Composer cache is sometimes needed). WordPress seems to add extra complications. As a matter of fact, might I prevail on you to update issue #3944? Other users have tried to integrate PhpSpreadsheet with WordPress without success. Please tell them how you've done it .
@oleibman well, I would rather consider it a hacky workaround than a real solution.. but I also do not have so much know how about the composere and how the php namespace mechanisms work to find a better solution..
hehe I have already seen that other ticket during my research phase to figure out how to make it work.. I can leave a comment there, but I guess it's not exactly the same case..
I am using PhpSpreadsheet in a Wordpress environment to offer custom functionality via Rest API.
Now I am having the situation, that one of my Wordpress Plugins uses the Dependency
maennchen/zipstream-php
in Version2.2.6
.This leads to the following exception when trying to do the hello world example of PhpSpreadsheet:
From what I can tell after analyzing the situation, it seems that
PhpSpreadsheet
uses the dependencymaennchen/zipstream-php
from the Wordpress Pluginfilebird-pro
which as mentioned uses Version2.2.6
instead of using the correct 3.x VersionAs soon as I deactivate the Wordpress Plugin, everything works as expected. Sadly, deactivating it is not a real long term option.
I hav also tried explicitely requiring
maennchen/zipstream-php
in my Composer Json with a 3.x Version, this did also not help.I have seen, that
PhpSpreadsheet
contains a switch to use either Zipstream 2 or 3. Is there maybe a bug in the init logic for Version 2?The text was updated successfully, but these errors were encountered: