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