1--TEST--
2Test session_get_cookie_params() function : error functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--FILE--
6<?php
7
8ob_start();
9
10/*
11 * Prototype : array session_get_cookie_params(void)
12 * Description : Get the session cookie parameters
13 * Source code : ext/session/session.c
14 */
15
16echo "*** Testing session_get_cookie_params() : error functionality ***\n";
17
18// Get an unset variable
19$unset_var = 10;
20unset($unset_var);
21
22class classA
23{
24    public function __toString() {
25        return "Hello World!";
26    }
27}
28
29$heredoc = <<<EOT
30Hello World!
31EOT;
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;
84foreach($inputs as $input) {
85    echo "\n-- Iteration $iterator --\n";
86    var_dump(session_get_cookie_params($input));
87    $iterator++;
88};
89
90fclose($fp);
91echo "Done";
92ob_end_flush();
93?>
94--EXPECTF--
95*** Testing session_get_cookie_params() : error functionality ***
96
97-- Iteration 1 --
98
99Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
100NULL
101
102-- Iteration 2 --
103
104Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
105NULL
106
107-- Iteration 3 --
108
109Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
110NULL
111
112-- Iteration 4 --
113
114Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
115NULL
116
117-- Iteration 5 --
118
119Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
120NULL
121
122-- Iteration 6 --
123
124Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
125NULL
126
127-- Iteration 7 --
128
129Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
130NULL
131
132-- Iteration 8 --
133
134Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
135NULL
136
137-- Iteration 9 --
138
139Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
140NULL
141
142-- Iteration 10 --
143
144Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
145NULL
146
147-- Iteration 11 --
148
149Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
150NULL
151
152-- Iteration 12 --
153
154Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
155NULL
156
157-- Iteration 13 --
158
159Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
160NULL
161
162-- Iteration 14 --
163
164Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
165NULL
166
167-- Iteration 15 --
168
169Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
170NULL
171
172-- Iteration 16 --
173
174Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
175NULL
176
177-- Iteration 17 --
178
179Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
180NULL
181
182-- Iteration 18 --
183
184Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
185NULL
186
187-- Iteration 19 --
188
189Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
190NULL
191
192-- Iteration 20 --
193
194Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
195NULL
196
197-- Iteration 21 --
198
199Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
200NULL
201
202-- Iteration 22 --
203
204Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
205NULL
206
207-- Iteration 23 --
208
209Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
210NULL
211
212-- Iteration 24 --
213
214Warning: session_get_cookie_params() expects exactly 0 parameters, 1 given in %s on line %d
215NULL
216Done
217