-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
ZipStream\ZipStream::__construct(): Argument #1 ($comment) must be of type string, null given, called in \vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\ZipStream2.php on line 19 #3615
Comments
@TwanaAssad Is it possible that you have both ZipStream v2 and v3 installed at the same time? If I had to guess, Try cleanly reinstalling all your dependencies. |
I have the same problem in Laravel, I tried:
|
I found a bad solution but I needed urgently, changing vendor class: Code:
|
If you have ZipStream2 installed, Archive::class should exist. If you have ZipStream3 installed, Archive::class should not exist. From your description, it sounds like you have ZipStream3 but also have Archive::class. So let's try to verify that to start. Question 1 - Does directory vendor/maennchen/zipstream-php/src/Option/Archive exist on your system? Question 2 - Does vendor/maennchen/zipstream-php/src/ZipStream.php have code that looks like: public function __construct(?string $name = null, ?ArchiveOptions $opt = null) Or does it look like: public function __construct(
private OperationMode $operationMode = OperationMode::NORMAL,
private readonly string $comment = '',
$outputStream = null,
private readonly CompressionMethod $defaultCompressionMethod = CompressionMethod::DEFLATE,
private readonly int $defaultDeflateLevel = 6,
private readonly bool $enableZip64 = true,
private readonly bool $defaultEnableZeroHeader = true,
private bool $sendHttpHeaders = true,
?Closure $httpHeaderCallback = null,
private readonly ?string $outputName = null,
private readonly string $contentDisposition = 'attachment',
private readonly string $contentType = 'application/x-zip',
private bool $flushOutput = false,
) { |
Question 1: Question 2:
|
I had the same problem with Codeigniter on Ubuntu server. Php 8.2 CI 4.3.5 I hope it can help |
THX daveaki! |
Thank you @daveaki for helping to unravel this mystery. |
@daveaki thanks, you helped me . |
recent versions of zipstream require an operation mode as first argument public function __construct( before it was public function __construct(?string $name = null, ?ArchiveOptions $opt = null) so i guess that's the issue |
Thanks so much @deloz , I also had the same issue and your steps worked. php 8.0.2 |
Adding this dependency to my
I guess the quick fix for this issue is to just adjust the dependency version of |
For php 8.2 compatibility it appears
also needs to be added. |
@DaDummy ZipStream v3 uses native enumns and does not need any dependencies. Also the guarantee of stability in function arguments is only on named arguments, not the order since there are so many. |
This solved it for me thank you :-) |
Another case for this error is if any other part of your code is requiring zipstream in version 2. In my case, I am using this library in a wordpress plugin. However, another wordpress plugin is using zipstream 2 which resulted in this error (zipstream2 being used instead of zipstream3). |
i fixed by require-ing from v3 to v2 and now with zipstream 2 is working now. |
This is:
If this is an issue with reading a specific spreadsheet file, then it may be appropriate to provide a sample file that demonstrates the problem; but please keep it as small as possible, and sanitize any confidential information before uploading.
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Which versions of PhpSpreadsheet and PHP are affected?
The text was updated successfully, but these errors were encountered: