|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-05-04 16:13 UTC] imprec at gmail dot com
-Status: Open
+Status: Closed
[2013-05-04 16:13 UTC] imprec at gmail dot com
[2013-05-04 16:43 UTC] pajoye@php.net
-Status: Closed
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 13:00:01 2025 UTC |
Description: ------------ On PHP 5.5, when creating an archive with either ZIPARCHIVE::CREATE or ZIPARCHIVE::OVERWRITE, then adding a file and finally closing it, the close method returns false and the handle on the zip file is not closed. So, if you try to chmod your zip file after that, it will fail. Test script: --------------- Here is a standard code that reproduce the bug : if (file_exists('test.zip')) { unlink('test.zip'); } $zip = new ZipArchive(); var_dump($zip->open('test.zip', ZIPARCHIVE::CREATE)); var_dump($zip->addFile(__FILE__, 'script.php')); var_dump($zip->close()); var_dump(@chmod('test.zip', 0760)); The bug is visible on travis : https://travis-ci.org/romainneutron/travis-tests/jobs/6881256 with the PHPUnit script : https://github.com/romainneutron/travis-tests/blob/master/tests/Tests/ZipTest.php Expected result: ---------------- bool(true) bool(true) bool(true) bool(true) Actual result: -------------- bool(true) bool(true) bool(false) bool(false)