Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/zip/php_zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2788,7 +2788,7 @@ static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */

ZIP_FROM_OBJECT(intern, self);

PHP_ZIP_STAT_INDEX(intern, index, 0, sb);
PHP_ZIP_STAT_INDEX(intern, index, flags, sb);
}

if (sb.size < 1) {
Expand Down
33 changes: 33 additions & 0 deletions ext/zip/tests/bug_gh21705.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--TEST--
ZipArchive::getFromIndex() honors FL_UNCHANGED for deleted entries
--EXTENSIONS--
zip
--FILE--
<?php
$name = __DIR__ . '/bug_gh21705.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));

$zip->close();
?>
--CLEAN--
<?php
$name = __DIR__ . '/bug_gh21705.zip';
@unlink($name);
?>
--EXPECT--
string(3) "bar"
string(3) "bar"
Loading