Bug #71064 [Com]: open($string, ZipArchive::OVERWRITE) does not create non-existing archives

From: Date: Wed, 16 Dec 2015 19:34:25 +0000
Subject: Bug #71064 [Com]: open($string, ZipArchive::OVERWRITE) does not create non-existing archives
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197938@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71064&edit=1 ID: 71064 Comment by: jkeller at berkeley dot edu Reported by: php at rachuth dot de Summary: open($string, ZipArchive::OVERWRITE) does not create non-existing archives Status: Open Type: Bug Package: Zip Related Operating System: * PHP Version: 5.6.16 Block user comment: N Private report: N New Comment: workaround is to use ZipArchive::CREATE | ZipArchive::OVERWRITE instead of ZipArchive::OVERWRITE Previous Comments: ------------------------------------------------------------------------ [2015-12-08 14:56:15] php at rachuth dot de Description: ------------ There is an issue with the ZipArchive class' open() method. In previous versions of PHP when the only flag passed to the method was the ZipArchive::OVERWRITE, the method also created non-existing archives. Since PHP 5.6 the OVERWRITE flag alone cannot create new archives which breaks compatibility. Test script: --------------- // Open new archive in cwd based on timestamp $zip = new ZipArchive(); $open = $zip->open(time() . '.zip', ZipArchive::OVERWRITE); echo $open; Expected result: ---------------- Expected behavior: The new archive is opened as in the previous version. Actual result: -------------- In PHP 5.5 an empty archive is opened. In PHP 5.6 ZipArchive::ER_OPEN error code is returned (cannot open zip file). ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71064&edit=1

« previous php.bugs (#197938) next »