xref: /PHP-8.1/ext/zip/tests/bug81420.phpt (revision df2ceac2)
1--TEST--
2Bug #81420 (ZipArchive::extractTo extracts outside of destination)
3--SKIPIF--
4<?php
5if (!extension_loaded("zip")) die("skip zip extension not available");
6?>
7--FILE--
8<?php
9$zip = new ZipArchive();
10$zip->open(__DIR__ . "/bug81420.zip");
11$destination = __DIR__ . "/bug81420";
12mkdir($destination);
13$zip->extractTo($destination);
14var_dump(file_exists("$destination/nt1/zzr_noharm.php"));
15?>
16--CLEAN--
17<?php
18$destination = __DIR__ . "/bug81420";
19@unlink("$destination/nt1/zzr_noharm.php");
20@rmdir("$destination/nt1");
21@rmdir($destination);
22?>
23--EXPECT--
24bool(true)
25