xref: /PHP-8.0/ext/zip/tests/bug70752.phpt (revision a555cc0b)
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--EXPECT--
23bool(false)
24bool(false)
25--CLEAN--
26<?php
27$filename =  __DIR__ . DIRECTORY_SEPARATOR . 'bug70752.txt';
28unlink($filename);
29?>
30