Annotation of embedaddon/php/Zend/tests/002.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: func_get_arg() tests
3: --FILE--
4: <?php
5:
6: function test1() {
7: var_dump(func_get_arg(-10));
8: var_dump(func_get_arg(0));
9: var_dump(func_get_arg(1));
10: }
11:
12: function test2($a) {
13: var_dump(func_get_arg(0));
14: var_dump(func_get_arg(1));
15: }
16:
17: function test3($a, $b) {
18: var_dump(func_get_arg(0));
19: var_dump(func_get_arg(1));
20: var_dump(func_get_arg(2));
21: }
22:
23: test1();
24: test1(10);
25: test2(1);
26: test2();
27: test3(1,2);
28:
29: call_user_func("test1");
30: call_user_func("test3", 1);
31: call_user_func("test3", 1, 2);
32:
33: class test {
34: static function test1($a) {
35: var_dump(func_get_arg(0));
36: var_dump(func_get_arg(1));
37: }
38: }
39:
40: test::test1(1);
41: var_dump(func_get_arg(1));
42:
43: echo "Done\n";
44: ?>
45: --EXPECTF--
46: Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
47: bool(false)
48:
49: Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
50: bool(false)
51:
52: Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
53: bool(false)
54:
55: Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
56: bool(false)
57: int(10)
58:
59: Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
60: bool(false)
61: int(1)
62:
63: Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
64: bool(false)
65:
66: Warning: Missing argument 1 for test2(), called in %s on line %d and defined in %s on line %d
67:
68: Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
69: bool(false)
70:
71: Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
72: bool(false)
73: int(1)
74: int(2)
75:
76: Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
77: bool(false)
78:
79: Warning: func_get_arg(): The argument number should be >= 0 in %s on line %d
80: bool(false)
81:
82: Warning: func_get_arg(): Argument 0 not passed to function in %s on line %d
83: bool(false)
84:
85: Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
86: bool(false)
87:
88: Warning: Missing argument 2 for test3() in %s on line %d
89: int(1)
90:
91: Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
92: bool(false)
93:
94: Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
95: bool(false)
96: int(1)
97: int(2)
98:
99: Warning: func_get_arg(): Argument 2 not passed to function in %s on line %d
100: bool(false)
101: int(1)
102:
103: Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d
104: bool(false)
105:
106: Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d
107: bool(false)
108: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>