-
Notifications
You must be signed in to change notification settings - Fork 60
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
setPassword corrupting files #30
Comments
Attach the created zip-archive and report the version of the library, PHP, OS. |
I won't be able to attach the created zip. It was the most recent version, PHP7.1 and Windows 10. |
Have you solved this problem? My version is version php5.6. After setting the password, it will prompt that the file is damaged when decompressing |
Sorry @529834149 but I no longer work on the project that I encountered this on, and I don't remember the solution. I think I used a different package! |
We're having the same issue here. Anyone know a workaround for this? |
I have tried to reproduce this issue on Windows 10. When I extract the file with 7-ZIP the password-protected ZIP file can be extracted. This error usually occurs when a ZIP file is encrypted with a password, but Windows cannot detect that it is an encrypted file.
Then I tried to encrypt the ZIP files with different encryption methods and decrypt it with the Windows built-in function. Here are the results:
This file was created with 7-ZIP
It seems that Windows (10) supports only the traditional PKWARE encryption and ZipCrypto, but not AES-*. So, to make it work on Windows, just pass Working example: use PhpZip\Constants\ZipEncryptionMethod;
use PhpZip\ZipFile;
// ...
$zipFile = new ZipFile();
$zipFile->addDir(__DIR__ . '/csv');
$zipFile->setPassword('password', ZipEncryptionMethod::PKWARE);
$zipFile->saveAsFile(__DIR__ . '/zipfile-pkware.zip')->close(); |
Description
setPassword
corrupts my CSV filesHow to reproduce
The text was updated successfully, but these errors were encountered: