xref: /PHP-8.1/ext/zip/tests/bug53603.phpt (revision 74859783)
1--TEST--
2Bug #53603 (ZipArchive should quiet stat errors)
3--EXTENSIONS--
4zip
5--FILE--
6<?php
7
8class TestStream {
9    function url_stat($path, $flags) {
10        if (!($flags & STREAM_URL_STAT_QUIET))
11            trigger_error("not quiet");
12        return array();
13    }
14}
15
16stream_wrapper_register("teststream", "TestStream");
17
18$dirname = __DIR__ . '/';
19$file = $dirname . 'test_with_comment.zip';
20$zip = new ZipArchive;
21if ($zip->open($file) !== TRUE) {
22    echo "open failed.\n";
23    exit('failed');
24}
25
26$a = $zip->extractTo('teststream://test');
27var_dump($a);
28?>
29--EXPECTF--
30Warning: ZipArchive::extractTo(teststream://test/foo): Failed to open stream: "TestStream::stream_open" call failed in %s on line %d
31bool(false)
32