Annotation of embedaddon/php/ext/session/tests/session_set_cookie_params_error.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test session_set_cookie_params() function : error functionality
3: --SKIPIF--
4: <?php include('skipif.inc'); ?>
5: --FILE--
6: <?php
7:
8: ob_start();
9:
10: /*
11: * Prototype : void session_set_cookie_params(int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly]]]])
12: * Description : Set the session cookie parameters
13: * Source code : ext/session/session.c
14: */
15:
16: echo "*** Testing session_set_cookie_params() : 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_set_cookie_params($input));
87: var_dump(session_set_cookie_params(1234567890, $input));
88: var_dump(session_set_cookie_params(1234567890, "blah", $input));
89: var_dump(session_set_cookie_params(1234567890, "blah", "foo", $input));
90: var_dump(session_set_cookie_params(1234567890, "blah", "foo", TRUE, $input));
91: var_dump(session_set_cookie_params(1234567890, "blah", "foo", TRUE, FALSE));
92: $iterator++;
93: };
94:
95: fclose($fp);
96: echo "Done";
97: ob_end_flush();
98: ?>
99: --EXPECTF--
100: *** Testing session_set_cookie_params() : error functionality ***
101:
102: -- Iteration 1 --
103: NULL
104: NULL
105: NULL
106: NULL
107: NULL
108: NULL
109:
110: -- Iteration 2 --
111: NULL
112: NULL
113: NULL
114: NULL
115: NULL
116: NULL
117:
118: -- Iteration 3 --
119: NULL
120: NULL
121: NULL
122: NULL
123: NULL
124: NULL
125:
126: -- Iteration 4 --
127: NULL
128: NULL
129: NULL
130: NULL
131: NULL
132: NULL
133:
134: -- Iteration 5 --
135: NULL
136: NULL
137: NULL
138: NULL
139: NULL
140: NULL
141:
142: -- Iteration 6 --
143: NULL
144: NULL
145: NULL
146: NULL
147: NULL
148: NULL
149:
150: -- Iteration 7 --
151: NULL
152: NULL
153: NULL
154: NULL
155: NULL
156: NULL
157:
158: -- Iteration 8 --
159: NULL
160: NULL
161: NULL
162: NULL
163: NULL
164: NULL
165:
166: -- Iteration 9 --
167: NULL
168: NULL
169: NULL
170: NULL
171: NULL
172: NULL
173:
174: -- Iteration 10 --
175: NULL
176: NULL
177: NULL
178: NULL
179: NULL
180: NULL
181:
182: -- Iteration 11 --
183: NULL
184: NULL
185: NULL
186: NULL
187: NULL
188: NULL
189:
190: -- Iteration 12 --
191: NULL
192: NULL
193: NULL
194: NULL
195: NULL
196: NULL
197:
198: -- Iteration 13 --
199: NULL
200: NULL
201: NULL
202: NULL
203: NULL
204: NULL
205:
206: -- Iteration 14 --
207: NULL
208: NULL
209: NULL
210: NULL
211: NULL
212: NULL
213:
214: -- Iteration 15 --
215: NULL
216: NULL
217: NULL
218: NULL
219: NULL
220: NULL
221:
222: -- Iteration 16 --
223: NULL
224: NULL
225: NULL
226: NULL
227: NULL
228: NULL
229:
230: -- Iteration 17 --
231: NULL
232: NULL
233: NULL
234: NULL
235: NULL
236: NULL
237:
238: -- Iteration 18 --
239: NULL
240: NULL
241: NULL
242: NULL
243: NULL
244: NULL
245:
246: -- Iteration 19 --
247: NULL
248: NULL
249: NULL
250: NULL
251: NULL
252: NULL
253:
254: -- Iteration 20 --
255: NULL
256: NULL
257: NULL
258: NULL
259: NULL
260: NULL
261:
262: -- Iteration 21 --
263: NULL
264: NULL
265: NULL
266:
267: Warning: session_set_cookie_params() expects parameter 4 to be boolean, object given in %s on line %d
268: NULL
269:
270: Warning: session_set_cookie_params() expects parameter 5 to be boolean, object given in %s on line %d
271: NULL
272: NULL
273:
274: -- Iteration 22 --
275: NULL
276: NULL
277: NULL
278: NULL
279: NULL
280: NULL
281:
282: -- Iteration 23 --
283: NULL
284: NULL
285: NULL
286: NULL
287: NULL
288: NULL
289:
290: -- Iteration 24 --
291: NULL
292:
293: Warning: session_set_cookie_params() expects parameter 2 to be string, resource given in %s on line %d
294: NULL
295:
296: Warning: session_set_cookie_params() expects parameter 3 to be string, resource given in %s on line %d
297: NULL
298:
299: Warning: session_set_cookie_params() expects parameter 4 to be boolean, resource given in %s on line %d
300: NULL
301:
302: Warning: session_set_cookie_params() expects parameter 5 to be boolean, resource given in %s on line %d
303: NULL
304: NULL
305: Done
306:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>