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--EXPECT--
83===data:,012345===
84int(0)
85bool(false)
86===S:4,S===
87int(0)
88int(4)
89bool(false)
90===GETC===
91string(1) "4"
92int(5)
93bool(false)
94===GETC===
95string(1) "5"
96bool(false)
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(0)
129int(13)
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(0)
141int(7)
142bool(false)
143