xref: /PHP-7.2/ext/zip/tests/bug70752.phpt (revision 8aad3131)
1--TEST--
2Bug #70752 (Depacking with wrong password leaves 0 length files)
3--SKIPIF--
4<?php
5if (!extension_loaded('zip')) die('skip zip extension not available');
6?>
7--FILE--
8<?php
9$filename = __DIR__ . DIRECTORY_SEPARATOR . 'bug70752.zip';
10$zip = new ZipArchive();
11$zip->open($filename);
12
13$filename =  __DIR__ . DIRECTORY_SEPARATOR . 'bug70752.txt';
14var_dump(file_exists($filename));
15
16$zip->setPassword('bar'); // correct password would be 'foo'
17$zip->extractTo(__DIR__);
18$zip->close();
19
20var_dump(file_exists($filename));
21?>
22===DONE===
23--EXPECT--
24bool(false)
25bool(false)
26===DONE===
27--CLEAN--
28<?php
29$filename =  __DIR__ . DIRECTORY_SEPARATOR . 'bug70752.txt';
30unlink($filename);
31?>
32