Page 1 of 1

ZipArchive::deleteName() not working

PostPosted: 21. September 2009 09:32
by harryd
The code below behaves unexpectedly: it tries to delete an entry from an archive, but it does not get deleted. I ran the same code on a Linux server and it works fine. Any suggestions?
<?php
$fname='somefile.txt';
$z=new ZipArchive;
$z->open('somearchive.zip');

echo "<p>before: ".$z->getFromName($fname); // shows the contents as expected
$res=$z->deleteName($fname); // $res is true!
echo "<p>after: ".$z->getFromName($fname); // shows no content, as expected
$z->close;

$z=new ZipArchive;
$z->open('somearchive.zip');
echo "<p>and again: ".$z->getFromName($fname); // shows contents. Quite unexpected.
$z->close;
?>