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(ftell($fp));
31	var_dump(feof($fp));
32	echo "===REWIND===\n";
33	var_dump(rewind($fp));
34	var_dump(ftell($fp));
35	var_dump(feof($fp));
36	echo "===GETC===\n";
37	var_dump(fgetc($fp));
38	var_dump(ftell($fp));
39	var_dump(feof($fp));
40	echo "===S:3,S===\n";
41	var_dump(fseek($fp, 3, SEEK_SET));
42	var_dump(ftell($fp));
43	var_dump(feof($fp));
44	echo "===S:1,C===\n";
45	var_dump(fseek($fp, 1, SEEK_CUR));
46	var_dump(ftell($fp));
47	var_dump(feof($fp));
48	echo "===S:-2,C===\n";
49	var_dump(fseek($fp, -2, SEEK_CUR));
50	var_dump(ftell($fp));
51	var_dump(feof($fp));
52	echo "===S:-10,C===\n";
53	var_dump(fseek($fp, -10, SEEK_CUR));
54	var_dump(ftell($fp));
55	var_dump(feof($fp));
56	echo "===S:3,S===\n";
57	var_dump(fseek($fp, 3, SEEK_SET));
58	var_dump(ftell($fp));
59	var_dump(feof($fp));
60	echo "===S:10,C===\n";
61	var_dump(fseek($fp, 10, SEEK_CUR));
62	var_dump(ftell($fp));
63	var_dump(feof($fp));
64	echo "===S:-1,E===\n";
65	var_dump(fseek($fp, -1, SEEK_END));
66	var_dump(ftell($fp));
67	var_dump(feof($fp));
68	echo "===S:0,E===\n";
69	var_dump(fseek($fp, 0, SEEK_END));
70	var_dump(ftell($fp));
71	var_dump(feof($fp));
72	echo "===S:1,E===\n";
73	var_dump(fseek($fp, 1, SEEK_END));
74	var_dump(ftell($fp));
75	var_dump(feof($fp));
76
77	fclose($fp);
78}
79
80?>
81===DONE===
82<?php exit(0); ?>
83--EXPECTF--
84===data:,012345===
85int(0)
86bool(false)
87===S:4,S===
88int(0)
89int(4)
90bool(false)
91===GETC===
92string(1) "4"
93int(5)
94bool(false)
95===GETC===
96string(1) "5"
97int(6)
98bool(true)
99===REWIND===
100bool(true)
101int(0)
102bool(false)
103===GETC===
104string(1) "0"
105int(1)
106bool(false)
107===S:3,S===
108int(0)
109int(3)
110bool(false)
111===S:1,C===
112int(0)
113int(4)
114bool(false)
115===S:-2,C===
116int(0)
117int(2)
118bool(false)
119===S:-10,C===
120int(-1)
121bool(false)
122bool(false)
123===S:3,S===
124int(0)
125int(3)
126bool(false)
127===S:10,C===
128int(-1)
129bool(false)
130bool(false)
131===S:-1,E===
132int(0)
133int(5)
134bool(false)
135===S:0,E===
136int(0)
137int(6)
138bool(false)
139===S:1,E===
140int(-1)
141bool(false)
142bool(false)
143===DONE===
144