Closed
Description
Deprecated: ZipArchive::open(): Passing null to parameter #2 ($flags) of type int is deprecated in /var/itrans/one/app/Vendor/phpoffice/phpword/src/PhpWord/Shared/ZipArchive.php on line 136
The current method signature of ZipArchive::open()
is public function open($filename, $flags = null)
.
If no argument is passed as the second argument here, null
is passed as the second argument on line 136:
$zip = new \ZipArchive();
$result = $zip->open($this->filename, $flags); // <-- line 136
Passing 0
achieves the same behaviour as passing null
. Therefore, I believe the appropriate fix here would be:
$zip = new \ZipArchive();
if ($flags === null) {
$flags = 0;
}
$result = $zip->open($this->filename, $flags);
This would eliminate the deprecation and not break any BC within the library.
I'm happy to submit a PR if required.