Description
The following code:
<?php
$name = __DIR__ . '/test.zip';
@unlink($name);
$zip = new ZipArchive;
$zip->open($name, ZipArchive::CREATE);
$zip->addFromString('foo.txt', 'foo');
$zip->addFromString('bar.txt', 'bar');
$zip->close();
$zip = new ZipArchive;
$zip->open($name);
$index = $zip->locateName('bar.txt');
$zip->deleteName('bar.txt');
var_dump($zip->getFromName('bar.txt', 0, ZipArchive::FL_UNCHANGED));
var_dump($zip->getFromIndex($index, 0, ZipArchive::FL_UNCHANGED)); // the ZipArchive::FL_UNCHANGED is ignored
$zip->close();
@unlink($name);
?>
Resulted in this output:
string(3) "bar"
bool(false)
But I expected this output instead:
string(3) "bar"
string(3) "bar"
Seems like ZipArchive::getFromIndex() accepts a $flags argument, but in ext/zip/php_zip.c the index lookup path does not pass those flags to zip_stat_index(). getFromName() works, but getFromIndex() does not honor FL_UNCHANGED.
PHP Version
Operating System
No response
Description
The following code:
Resulted in this output:
But I expected this output instead:
Seems like
ZipArchive::getFromIndex()accepts a$flagsargument, but inext/zip/php_zip.cthe index lookup path does not pass those flags tozip_stat_index().getFromName()works, butgetFromIndex()does not honor FL_UNCHANGED.PHP Version
Operating System
No response