Update EPV and remove deprecated Chumper/Zipper package#395
Update EPV and remove deprecated Chumper/Zipper package#395DavidIQ merged 3 commits intophpbb:3.3.xfrom
Conversation
composer.lockPackage changes
Settings · Docs · Powered by Private Packagist |
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
1 similar comment
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
| for ($i = 0; $i < $source_zip->numFiles; $i++) | ||
| { | ||
| $stat = $source_zip->statIndex($i); | ||
| if (str_starts_with($stat['name'], $source_path)) |
There was a problem hiding this comment.
str_starts_with is PHP8, but our PHP level is 7.2. Also there's some repeated processing inside the loop that can be done pre loop. Consider and test out this alternative code:
private function add_to_zip(ZipArchive $source_zip, ZipArchive $dest_zip, $save_version, $source_path)
{
$source_path = rtrim($source_path, '/') . '/';
$prefix_length = strlen($source_path);
for ($i = 0; $i < $source_zip->numFiles; $i++)
{
$stat = $source_zip->statIndex($i);
$entry_name = $stat['name'];
if (strpos($entry_name, $source_path) !== 0)
{
continue;
}
$relative_path = substr($entry_name, $prefix_length);
$dest_path = $save_version . '/' . $relative_path;
// Check if it's a directory (size is 0 and the name ends with '/')
if ($stat['size'] === 0 && substr($entry_name, -1) === '/')
{
$dest_zip->addEmptyDir($dest_path);
continue;
}
$file_contents = $source_zip->getFromName($entry_name);
if ($file_contents !== false)
{
$dest_zip->addFromString($dest_path, $file_contents);
}
}
}There was a problem hiding this comment.
str_starts_withis PHP8, but our PHP level is 7.2.
That's correct. But there is no issue with using it because Titania uses symfony/polyfill-php80 which provides this function.
There is also the same issue with this array_key_first function, which is only available since PHP 7.3."
Consider and test out this alternative code:
Thanks for the code. There was an issue with it, but it's fixed.
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
|
You'll need to update again. |
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
1 similar comment
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
d8c2ca4 to
adf3052
Compare
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
|
Done :) |
|
Oops...I needed to merge this before #403. Sorry, you'll need to update again. 😬 |
|
😭 |
adf3052 to
b3b8f8d
Compare
|
The composer.lock diff comment has been updated to reflect new changes in this PR. |
|
@DavidIQ update done. I hope this time it's okay for the merger🤞 |
|
Hi @DavidIQ |
No description provided.