Annotation of embedaddon/php/ext/phar/tests/022.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: stream stat
3: --SKIPIF--
4: <?php if (!extension_loaded("phar")) die("skip"); ?>
5: --INI--
6: phar.require_hash=0
7: --FILE--
8: <?php
9: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
10: $pname = 'phar://' . $fname;
11: $file = "<?php
12: Phar::mapPhar('hio');
13: __HALT_COMPILER(); ?>";
14:
15: $files = array();
16: $files['a'] = 'abcdefg';
17:
18: include 'files/phar_test.inc';
19:
20: include $fname;
21:
22: $fp = fopen('phar://hio/a', 'r');
23: var_dump(ftell($fp));
24: echo 'fseek($fp, 1)';var_dump(fseek($fp, 1));
25: var_dump(ftell($fp));
26: echo 'fseek($fp, 1, SEEK_CUR)';var_dump(fseek($fp, 1, SEEK_CUR));
27: var_dump(ftell($fp));
28: echo 'fseek($fp, -1, SEEK_CUR)';var_dump(fseek($fp, -1, SEEK_CUR));
29: var_dump(ftell($fp));
30: echo 'fseek($fp, -1, SEEK_END)';var_dump(fseek($fp, -1, SEEK_END));
31: var_dump(ftell($fp));
32: echo 'fseek($fp, -8, SEEK_END)';var_dump(fseek($fp, -8, SEEK_END));
33: var_dump(ftell($fp));
34: echo 'fseek($fp, -7, SEEK_END)';var_dump(fseek($fp, -7, SEEK_END));
35: var_dump(ftell($fp));
36: echo 'fseek($fp, 0, SEEK_END)';var_dump(fseek($fp, 0, SEEK_END));
37: var_dump(ftell($fp));
38: echo 'fseek($fp, 1, SEEK_END)';var_dump(fseek($fp, 1, SEEK_END));
39: var_dump(ftell($fp));
40: echo 'fseek($fp, -8, SEEK_END)';var_dump(fseek($fp, -8, SEEK_END));
41: var_dump(ftell($fp));
42: echo 'fseek($fp, 6)';var_dump(fseek($fp, 6));
43: var_dump(ftell($fp));
44: echo 'fseek($fp, 8)';var_dump(fseek($fp, 8));
45: var_dump(ftell($fp));
46: echo 'fseek($fp, -1)';var_dump(fseek($fp, -1));
47: var_dump(ftell($fp));
48: echo "next\n";
49: fseek($fp, 4);
50: var_dump(ftell($fp));
51: echo 'fseek($fp, -5, SEEK_CUR)';var_dump(fseek($fp, -5, SEEK_CUR));
52: var_dump(ftell($fp));
53: fseek($fp, 4);
54: var_dump(ftell($fp));
55: echo 'fseek($fp, 5, SEEK_CUR)';var_dump(fseek($fp, 5, SEEK_CUR));
56: var_dump(ftell($fp));
57: fseek($fp, 4);
58: var_dump(ftell($fp));
59: echo 'fseek($fp, -4, SEEK_CUR)';var_dump(fseek($fp, -4, SEEK_CUR));
60: var_dump(ftell($fp));
61: fseek($fp, 4);
62: var_dump(ftell($fp));
63: echo 'fseek($fp, 3, SEEK_CUR)';var_dump(fseek($fp, 3, SEEK_CUR));
64: var_dump(ftell($fp));
65: fclose($fp);
66: ?>
67: --CLEAN--
68: <?php
69: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
70: exit(0);
71: ?>
72: --EXPECT--
73: int(0)
74: fseek($fp, 1)int(0)
75: int(1)
76: fseek($fp, 1, SEEK_CUR)int(0)
77: int(2)
78: fseek($fp, -1, SEEK_CUR)int(0)
79: int(1)
80: fseek($fp, -1, SEEK_END)int(0)
81: int(6)
82: fseek($fp, -8, SEEK_END)int(-1)
83: bool(false)
84: fseek($fp, -7, SEEK_END)int(0)
85: int(0)
86: fseek($fp, 0, SEEK_END)int(0)
87: int(7)
88: fseek($fp, 1, SEEK_END)int(-1)
89: bool(false)
90: fseek($fp, -8, SEEK_END)int(-1)
91: bool(false)
92: fseek($fp, 6)int(0)
93: int(6)
94: fseek($fp, 8)int(-1)
95: bool(false)
96: fseek($fp, -1)int(-1)
97: bool(false)
98: next
99: int(4)
100: fseek($fp, -5, SEEK_CUR)int(-1)
101: bool(false)
102: int(4)
103: fseek($fp, 5, SEEK_CUR)int(-1)
104: bool(false)
105: int(4)
106: fseek($fp, -4, SEEK_CUR)int(0)
107: int(0)
108: int(4)
109: fseek($fp, 3, SEEK_CUR)int(0)
110: int(7)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>