1--TEST--
2Stream: RFC2397 and seeking
3--INI--
4allow_url_fopen=1
5--FILE--
6<?php
7
8$streams = array(
9	"data:,012345",
10	);
11
12foreach($streams as $stream)
13{
14	echo "===$stream===\n";
15
16	$fp = fopen($stream, 'rb');
17
18	var_dump(ftell($fp));
19	var_dump(feof($fp));
20	echo "===S:4,S===\n";
21	var_dump(fseek($fp, 4));
22	var_dump(ftell($fp));
23	var_dump(feof($fp));
24	echo "===GETC===\n";
25	var_dump(fgetc($fp));
26	var_dump(ftell($fp));
27	var_dump(feof($fp));
28	echo "===GETC===\n";
29	var_dump(fgetc($fp));
30	var_dump(fgetc($fp));
31	var_dump(ftell($fp));
32	var_dump(feof($fp));
33	echo "===REWIND===\n";
34	var_dump(rewind($fp));
35	var_dump(ftell($fp));
36	var_dump(feof($fp));
37	echo "===GETC===\n";
38	var_dump(fgetc($fp));
39	var_dump(ftell($fp));
40	var_dump(feof($fp));
41	echo "===S:3,S===\n";
42	var_dump(fseek($fp, 3, SEEK_SET));
43	var_dump(ftell($fp));
44	var_dump(feof($fp));
45	echo "===S:1,C===\n";
46	var_dump(fseek($fp, 1, SEEK_CUR));
47	var_dump(ftell($fp));
48	var_dump(feof($fp));
49	echo "===S:-2,C===\n";
50	var_dump(fseek($fp, -2, SEEK_CUR));
51	var_dump(ftell($fp));
52	var_dump(feof($fp));
53	echo "===S:-10,C===\n";
54	var_dump(fseek($fp, -10, SEEK_CUR));
55	var_dump(ftell($fp));
56	var_dump(feof($fp));
57	echo "===S:3,S===\n";
58	var_dump(fseek($fp, 3, SEEK_SET));
59	var_dump(ftell($fp));
60	var_dump(feof($fp));
61	echo "===S:10,C===\n";
62	var_dump(fseek($fp, 10, SEEK_CUR));
63	var_dump(ftell($fp));
64	var_dump(feof($fp));
65	echo "===S:-1,E===\n";
66	var_dump(fseek($fp, -1, SEEK_END));
67	var_dump(ftell($fp));
68	var_dump(feof($fp));
69	echo "===S:0,E===\n";
70	var_dump(fseek($fp, 0, SEEK_END));
71	var_dump(ftell($fp));
72	var_dump(feof($fp));
73	echo "===S:1,E===\n";
74	var_dump(fseek($fp, 1, SEEK_END));
75	var_dump(ftell($fp));
76	var_dump(feof($fp));
77
78	fclose($fp);
79}
80
81?>
82===DONE===
83<?php exit(0); ?>
84--EXPECTF--
85===data:,012345===
86int(0)
87bool(false)
88===S:4,S===
89int(0)
90int(4)
91bool(false)
92===GETC===
93string(1) "4"
94int(5)
95bool(false)
96===GETC===
97string(1) "5"
98bool(false)
99int(6)
100bool(true)
101===REWIND===
102bool(true)
103int(0)
104bool(false)
105===GETC===
106string(1) "0"
107int(1)
108bool(false)
109===S:3,S===
110int(0)
111int(3)
112bool(false)
113===S:1,C===
114int(0)
115int(4)
116bool(false)
117===S:-2,C===
118int(0)
119int(2)
120bool(false)
121===S:-10,C===
122int(-1)
123bool(false)
124bool(false)
125===S:3,S===
126int(0)
127int(3)
128bool(false)
129===S:10,C===
130int(-1)
131bool(false)
132bool(false)
133===S:-1,E===
134int(0)
135int(5)
136bool(false)
137===S:0,E===
138int(0)
139int(6)
140bool(false)
141===S:1,E===
142int(-1)
143bool(false)
144bool(false)
145===DONE===
146