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