$zip = new ZipArchive;
if (!$zip->open($file)) {
- exit('failed');
+ exit('failed');
}
if (!$zip->addFile($dirname . 'utils.inc', 'test.php')) {
- echo "failed\n";
+ echo "failed\n";
}
+ if (!$zip->addFile($dirname . 'utils.inc', 'mini.txt', 12, 34)) {
+ echo "failed\n";
+ }
if ($zip->status == ZIPARCHIVE::ER_OK) {
- if (!verify_entries($zip, [
- "bar",
- "foobar/",
- "foobar/baz",
- "entry1.txt",
- "test.php",
- "mini.txt"
- ])) {
- echo "failed\n";
- } else {
- echo "OK";
- }
- $zip->close();
+ if (!verify_entries($zip, [
+ "bar",
+ "foobar/",
+ "foobar/baz",
+ "entry1.txt",
- "test.php"
++ "test.php",
++ "mini.txt"
+ ])) {
+ echo "failed\n";
+ } else {
+ echo "OK";
+ }
+ $zip->close();
} else {
- echo "failed\n";
+ echo "failed\n";
}
+ if (!$zip->open($file)) {
+ exit('failed');
+ }
+ var_dump(strlen($zip->getFromName('test.php')) == filesize($dirname . 'utils.inc'));
+ var_dump(strlen($zip->getFromName('mini.txt')) == 34);
@unlink($file);
?>
--EXPECT--