note 119845 rejected from ziparchive.open by cmb

From: Date: Mon, 05 Sep 2016 15:16:37 +0000
Subject: note 119845 rejected from ziparchive.open by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-206501@lists.php.net to get a copy of this message
Note Submitter: fleporcq at gmail dot com ---- @eric at webdeveric dot com It's false! (since seven years...) <?php $zip->open( $zipFileName, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ); ?> ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE is always equal to 1 and ZIPARCHIVE::CREATE = 1 your line is equal to : <?php $zip->open( $zipFileName, ZIPARCHIVE::CREATE); ?> and if you open an existing archive you append your files on it. you don't create a new archive... For me a good solution is : <?php if(!$zip->open($path . $zipName, ZIPARCHIVE::OVERWRITE)){ $zip->open($path . $zipName, ZIPARCHIVE::CREATE); } ?>

« previous php.notes (#206501) next »