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