Skip to content

Commit dd45a0b

Browse files
committed
make test simpler
1 parent 0d7b46c commit dd45a0b

2 files changed

Lines changed: 29 additions & 41 deletions

File tree

ext/zip/tests/ZipArchive_getFromIndex_unchanged_deleted.phpt

Lines changed: 0 additions & 41 deletions
This file was deleted.

ext/zip/tests/bug21705.phpt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
ZipArchive::getFromIndex() honors FL_UNCHANGED for deleted entries
3+
--EXTENSIONS--
4+
zip
5+
--FILE--
6+
<?php
7+
$name = __DIR__ . '/test.zip';
8+
@unlink($name);
9+
$zip = new ZipArchive;
10+
$zip->open($name, ZipArchive::CREATE);
11+
$zip->addFromString('foo.txt', 'foo');
12+
$zip->addFromString('bar.txt', 'bar');
13+
$zip->close();
14+
15+
$zip = new ZipArchive;
16+
$zip->open($name);
17+
18+
$index = $zip->locateName('bar.txt');
19+
$zip->deleteName('bar.txt');
20+
21+
var_dump($zip->getFromName('bar.txt', 0, ZipArchive::FL_UNCHANGED));
22+
var_dump($zip->getFromIndex($index, 0, ZipArchive::FL_UNCHANGED)); // the ZipArchive::FL_UNCHANGED is ignored
23+
24+
$zip->close();
25+
@unlink($name);
26+
?>
27+
--EXPECT--
28+
string(3) "bar"
29+
string(3) "bar"

0 commit comments

Comments
 (0)