Bug #79296 [NEW]: ZipArchive::open with ZipArchive::CREATE flag fail when in the Mac OS TMPDIR

From: Date: Sat, 22 Feb 2020 11:10:57 +0000
Subject: Bug #79296 [NEW]: ZipArchive::open with ZipArchive::CREATE flag fail when in the Mac OS TMPDIR
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225664@lists.php.net to get a copy of this message
From: dunglas at gmail dot com Operating system: Mac OS X PHP version: 7.4.3 Package: Zip Related Bug Type: Bug Bug description:ZipArchive::open with ZipArchive::CREATE flag fail when in the Mac OS TMPDIR Description: ------------ Creating a Zip archive in the default temporary directory of Mac OS doesn't work with Mac OS Catalina. Using the default TMPDIR to store temporary Zip archive, is a common practice. For instance it's what PHP WebDriver does by default to create a temporary Firefox profile. Using the OVERWRITE flag of libzip instead of the CREATE one fixes the problem. This may be due do to the new security features introduced in Mac OS Catalina. Tested with PHP 7.4 and 8.0-dev, but this bug probably affects all versions. Test script: --------------- <?php $f = tempnam(sys_get_temp_dir(), 'WebDriverFirefoxProfileZip'); $zip = new ZipArchive(); $success = $zip->open($f, ZipArchive::CREATE); // this work // $success = $zip->open($f, ZipArchive::OVERWRITE); if ($success !== true) { die('Error code '.$success); } $zip->addFile(__DIR__.'/foo.txt', '/foo.txt'); $zip->close(); Expected result: ---------------- No errors Actual result: -------------- Error 19 #define ZIP_ER_NOZIP 19 /* N Not a zip archive */ -- Edit bug report at https://bugs.php.net/bug.php?id=79296&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79296&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79296&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79296&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79296&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79296&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79296&r=support Expected behavior: https://bugs.php.net/fix.php?id=79296&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79296&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79296&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79296&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79296&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79296&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79296&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79296&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79296&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79296&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79296&r=mysqlcfg

« previous php.bugs (#225664) next »