xref: /PHP-8.1/ext/zip/tests/bug14962.phpt (revision 74859783)
1--TEST--
2Bug #14962 (::extractTo second argument is not really optional)
3--EXTENSIONS--
4zip
5--FILE--
6<?php
7
8$dir = __DIR__;
9$file = '__tmp14962.txt';
10$fullpath = $dir . '/' . $file;
11$za = new ZipArchive;
12$za->open($dir . '/__14962.zip', ZIPARCHIVE::CREATE);
13$za->addFromString($file, '1234');
14$za->close();
15
16if (!is_file($dir . "/__14962.zip")) {
17    die('failed to create the archive');
18}
19$za = new ZipArchive;
20$za->open($dir . '/__14962.zip');
21$za->extractTo($dir, NULL);
22$za->close();
23
24if (is_file($fullpath)) {
25    unlink($fullpath);
26    echo "Ok";
27}
28unlink($dir . '/' . '__14962.zip');
29?>
30--EXPECT--
31Ok
32