summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/userstreams.phpt
blob: 6bdc50d0ba8274b4aa9e287e3345687c224c5ca6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--TEST--
User-space streams
--FILE--
<?php
# vim600:syn=php:

class uselessstream {
}

class mystream {

	function mystream()
	{
		echo "MYSTREAM: constructor called!\n";
	}

	var $path;
	var $mode;
	var $options;

	function stream_open($path, $mode, $options, &$opened_path)
	{
		$this->path = $path;
		$this->mode = $mode;
		$this->options = $options;
		return true;
	}

}

if (@file_register_wrapper("bogus", "class_not_exist"))
	die("Registered a non-existant class!!!???");

if (!file_register_wrapper("test", "mystream"))
	die("test wrapper registration failed");
if (!file_register_wrapper("bogon", "uselessstream"))
	die("bogon wrapper registration failed");

echo "Registered\n";

$b = @fopen("bogon://url", "rb");
if (is_resource($b))
	die("Opened a bogon??");

$fp = fopen("test://url", "rb");
if (!is_resource($fp))
	die("Failed to open resource");

?>
--EXPECT--
Registered