Annotation of embedaddon/php/ext/standard/tests/file/stream_rfc2397_007.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Stream: RFC2397 and seeking
3: --INI--
4: allow_url_fopen=1
5: --FILE--
6: <?php
7:
8: $streams = array(
9: "data:,012345",
10: );
11:
12: foreach($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===
85: int(0)
86: bool(false)
87: ===S:4,S===
88: int(0)
89: int(4)
90: bool(false)
91: ===GETC===
92: string(1) "4"
93: int(5)
94: bool(false)
95: ===GETC===
96: string(1) "5"
97: int(6)
98: bool(true)
99: ===REWIND===
100: bool(true)
101: int(0)
102: bool(false)
103: ===GETC===
104: string(1) "0"
105: int(1)
106: bool(false)
107: ===S:3,S===
108: int(0)
109: int(3)
110: bool(false)
111: ===S:1,C===
112: int(0)
113: int(4)
114: bool(false)
115: ===S:-2,C===
116: int(0)
117: int(2)
118: bool(false)
119: ===S:-10,C===
120: int(-1)
121: bool(false)
122: bool(false)
123: ===S:3,S===
124: int(0)
125: int(3)
126: bool(false)
127: ===S:10,C===
128: int(-1)
129: bool(false)
130: bool(false)
131: ===S:-1,E===
132: int(0)
133: int(5)
134: bool(false)
135: ===S:0,E===
136: int(0)
137: int(6)
138: bool(false)
139: ===S:1,E===
140: int(-1)
141: bool(false)
142: bool(false)
143: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>