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
Hello,
Thank you for this awesome library and the time you put into it 👍
I'm trying to use it and i get some issues along the way, hopefully you can take a look and maybe shed some light.
The part where the engine tries to open the archive:
$zip->open($realPath, ZIPARCHIVE::CHECKCONS);
just assumes the open process will always work, which is not the case.
It should be wrapped in something like:
if ($zip->open($realPath, ZIPARCHIVE::CHECKCONS) !== true) {
throw new RuntimeException(sprintf('Unable to open: %s', $realPath));
}
Of course, that code doesn't mean anything since it does not show the actual error, so you can map it like:
Which imho is a better workflow, because it also tells what's wrong, but it's up to you how you want to implement this.
Additionally, opening with ZIPARCHIVE::CHECKCONS flag will often complain with ZipArchive::ER_INCONS error for some valid archives, for example either one from https://www.mailwizz.com/free-email-templates/
Changing the flag to ZipArchive::CREATE seems to fix the issue, so the final code for me was:
Hello,
Thank you for this awesome library and the time you put into it 👍
I'm trying to use it and i get some issues along the way, hopefully you can take a look and maybe shed some light.
The part where the engine tries to open the archive:
just assumes the open process will always work, which is not the case.
It should be wrapped in something like:
Of course, that code doesn't mean anything since it does not show the actual error, so you can map it like:
Which imho is a better workflow, because it also tells what's wrong, but it's up to you how you want to implement this.
Additionally, opening with ZIPARCHIVE::CHECKCONS flag will often complain with
ZipArchive::ER_INCONS
error for some valid archives, for example either one from https://www.mailwizz.com/free-email-templates/Changing the flag to
ZipArchive::CREATE
seems to fix the issue, so the final code for me was:Further down the line, i believe the final check
should actually be:
But i am not sure about this entirely, so again, this is up to you since you know better how this works.
Best.
The text was updated successfully, but these errors were encountered: