|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2009-12-01 08:45 UTC] c dot hugot at uniteam dot fr
 Description:
------------
I create an archive (.zip) with class ZipArchive, with four files into. 
And when I want to delete the last file, in this archive, the function deleteName() return true, but the file is not remove from the archive.
The three others files were correctly remove, but not the last.
Reproduce code:
---------------
---
From manual page: function.ziparchive-deletename
---
        private function myDelZipFile($p_sName){
            $l_oZip = new ZipArchive();                       
            if($l_oZip->open(RACCORDEMENT_ZIP_FILE_PATH . "/" . $_SESSION['step5']['zip_name'] . ".zip", ZIPARCHIVE::OVERWRITE) === true){
                $l_oZip->deleteName( $_SESSION['step5'][$p_sName . '_name']) === true;
                $l_oZip->close();                
                return true;
            }            
            return false;            
        }
Expected result:
----------------
The archive file ever contained the last file. 
Actual result:
--------------
The archive would be empty.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 23:00:01 2025 UTC | 
<?php private function myDelZipFile($p_sName){ $l_oZip = new ZipArchive(); if($l_oZip->open(RACCORDEMENT_ZIP_FILE_PATH . "/" . $_SESSION['step5']['zip_name'] . ".zip", ZIPARCHIVE::OVERWRITE) === true){ $l_oZip->deleteName( $_SESSION['step5'][$p_sName.'_name']); $l_oZip->close(); return true; } return false; } ?>