Annotation of embedaddon/php/ext/session/tests/session_module_name_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test session_module_name() function : error functionality
3: --SKIPIF--
4: <?php include('skipif.inc'); ?>
5: --FILE--
6: <?php
7:
8: ob_start();
9:
10: /*
11: * Prototype : string session_module_name([string $module])
12: * Description : Get and/or set the current session module
13: * Source code : ext/session/session.c
14: */
15:
16: echo "*** Testing session_module_name() : error functionality ***\n";
17:
18: // Get an unset variable
19: $unset_var = 10;
20: unset($unset_var);
21:
22: class classA
23: {
24: public function __toString() {
25: return "Hello World!";
26: }
27: }
28:
29: $heredoc = <<<EOT
30: Hello World!
31: EOT;
32:
33: $fp = fopen(__FILE__, "r");
34:
35: // Unexpected values to be passed as arguments
36: $inputs = array(
37:
38: // Integer data
39: /*1*/ 0,
40: 1,
41: 12345,
42: -2345,
43:
44: // Float data
45: /*5*/ 10.5,
46: -10.5,
47: 12.3456789000e10,
48: 12.3456789000E-10,
49: .5,
50:
51: // Null data
52: /*10*/ NULL,
53: null,
54:
55: // Boolean data
56: /*12*/ true,
57: false,
58: TRUE,
59: FALSE,
60:
61: // Empty strings
62: /*16*/ "",
63: '',
64:
65: // Invalid string data
66: /*18*/ "Nothing",
67: 'Nothing',
68: $heredoc,
69:
70: // Object data
71: /*21*/ new classA(),
72:
73: // Undefined data
74: /*22*/ @$undefined_var,
75:
76: // Unset data
77: /*23*/ @$unset_var,
78:
79: // Resource variable
80: /*24*/ $fp
81: );
82:
83: $iterator = 1;
84: foreach($inputs as $input) {
85: echo "\n-- Iteration $iterator --\n";
86: var_dump(session_module_name($input));
87: $iterator++;
88: };
89:
90: fclose($fp);
91: echo "Done";
92: ob_end_flush();
93: ?>
94: --EXPECTF--
95: *** Testing session_module_name() : error functionality ***
96:
97: -- Iteration 1 --
98:
99: Warning: session_module_name(): Cannot find named PHP session module (0) in %s on line %d
100: bool(false)
101:
102: -- Iteration 2 --
103:
104: Warning: session_module_name(): Cannot find named PHP session module (1) in %s on line %d
105: bool(false)
106:
107: -- Iteration 3 --
108:
109: Warning: session_module_name(): Cannot find named PHP session module (12345) in %s on line %d
110: bool(false)
111:
112: -- Iteration 4 --
113:
114: Warning: session_module_name(): Cannot find named PHP session module (-2345) in %s on line %d
115: bool(false)
116:
117: -- Iteration 5 --
118:
119: Warning: session_module_name(): Cannot find named PHP session module (10.5) in %s on line %d
120: bool(false)
121:
122: -- Iteration 6 --
123:
124: Warning: session_module_name(): Cannot find named PHP session module (-10.5) in %s on line %d
125: bool(false)
126:
127: -- Iteration 7 --
128:
129: Warning: session_module_name(): Cannot find named PHP session module (123456789000) in %s on line %d
130: bool(false)
131:
132: -- Iteration 8 --
133:
134: Warning: session_module_name(): Cannot find named PHP session module (1.23456789E-9) in %s on line %d
135: bool(false)
136:
137: -- Iteration 9 --
138:
139: Warning: session_module_name(): Cannot find named PHP session module (0.5) in %s on line %d
140: bool(false)
141:
142: -- Iteration 10 --
143:
144: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
145: bool(false)
146:
147: -- Iteration 11 --
148:
149: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
150: bool(false)
151:
152: -- Iteration 12 --
153:
154: Warning: session_module_name(): Cannot find named PHP session module (1) in %s on line %d
155: bool(false)
156:
157: -- Iteration 13 --
158:
159: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
160: bool(false)
161:
162: -- Iteration 14 --
163:
164: Warning: session_module_name(): Cannot find named PHP session module (1) in %s on line %d
165: bool(false)
166:
167: -- Iteration 15 --
168:
169: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
170: bool(false)
171:
172: -- Iteration 16 --
173:
174: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
175: bool(false)
176:
177: -- Iteration 17 --
178:
179: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
180: bool(false)
181:
182: -- Iteration 18 --
183:
184: Warning: session_module_name(): Cannot find named PHP session module (Nothing) in %s on line %d
185: bool(false)
186:
187: -- Iteration 19 --
188:
189: Warning: session_module_name(): Cannot find named PHP session module (Nothing) in %s on line %d
190: bool(false)
191:
192: -- Iteration 20 --
193:
194: Warning: session_module_name(): Cannot find named PHP session module (Hello World!) in %s on line %d
195: bool(false)
196:
197: -- Iteration 21 --
198:
199: Warning: session_module_name(): Cannot find named PHP session module (Hello World!) in %s on line %d
200: bool(false)
201:
202: -- Iteration 22 --
203:
204: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
205: bool(false)
206:
207: -- Iteration 23 --
208:
209: Warning: session_module_name(): Cannot find named PHP session module () in %s on line %d
210: bool(false)
211:
212: -- Iteration 24 --
213:
214: Warning: session_module_name() expects parameter 1 to be string, resource given in %s on line %d
215: NULL
216: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>