1--TEST--
2Test basic function : variation3 use_trans_sid
3--INI--
4session.use_strict_mode=0
5session.use_only_cookies=0
6session.use_trans_sid=1
7session.save_handler=files
8session.gc_probability=1
9session.gc_divisor=1000
10session.gc_maxlifetime=300
11session.save_path=
12session.name=PHPSESSID
13url_rewriter.hosts=
14--EXTENSIONS--
15session
16--SKIPIF--
17<?php include('skipif.inc'); ?>
18--FILE--
19<?php
20
21ob_start();
22
23echo "*** Testing basic session functionality : variation3 use_trans_sid ***\n";
24
25/*
26echo "*** test output_add_rewrite_var() ***\n";
27output_add_rewrite_var('var', 'value');
28echo '
29<a href="/">test</a>
30<a href="/#bar">test</a>
31<a href="/?foo">test</a>
32<a href="/?foo#bar">test</a>
33<a href="/?foo=var">test</a>
34<a href="/?foo=var#bar">test</a>
35<a href="file.php">test</a>
36<a href="file.php?foo">test</a>
37<a href="file.php?foo=var">test</a>
38<a href="http://php.net">test</a>
39<a href="http://php.net/">test</a>
40<a href="http://php.net/#bar">test</a>
41<a href="http://php.net/?foo">test</a>
42<a href="http://php.net/?foo#bar">test</a>
43<a href="http://php.net/?foo=var">test</a>
44<a href="http://php.net/?foo=var#bar">test</a>
45<a href="http://php.net/file.php">test</a>
46<a href="http://php.net/file.php#bar">test</a>
47<a href="http://php.net/file.php?foo">test</a>
48<a href="http://php.net/file.php?foo#bar">test</a>
49<a href="http://php.net/file.php?foo=var">test</a>
50<a href="http://php.net/file.php?foo=var#bar">test</a>
51<a href="http://php.net/some/path/file.php">test</a>
52<a href="http://php.net/some/path/file.php?foo">test</a>
53<a href="http://php.net/some/path/file.php?foo=var">test</a>
54<a href="http://php.net/some/path/file.php?foo=var#bar">test</a>
55<a href="https://php.net">test</a>
56<a href="https://php.net/">test</a>
57<a href="https://php.net/?foo=var#bar">test</a>
58<a href="https://php.net/file.php">test</a>
59<a href="https://php.net/file.php?foo=var#bar">test</a>
60<a href="https://php.net/some/path/file.php">test</a>
61<a href="https://php.net/some/path/file.php?foo=var#bar">test</a>
62<a href="https://php.net:8443">test</a>
63<a href="https://php.net:8443/">test</a>
64<a href="https://php.net:8443/?foo=var#bar">test</a>
65<a href="https://php.net:8443/file.php">test</a>
66<a href="https://php.net:8443/file.php?foo=var#bar">test</a>
67<a href="https://php.net:8443/some/path/file.php">test</a>
68<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a>
69<a href="//php.net">test</a>
70<a href="//php.net/">test</a>
71<a href="//php.net/#bar">test</a>
72<a href="//php.net/?foo">test</a>
73<a href="//php.net/?foo#bar">test</a>
74<a href="//php.net/?foo=var">test</a>
75<a href="//php.net/?foo=var#bar">test</a>
76<a href="//php.net/file.php">test</a>
77<a href="//php.net/file.php#bar">test</a>
78<a href="//php.net/file.php?foo">test</a>
79<a href="//php.net/file.php?foo#bar">test</a>
80<a href="//php.net/file.php?foo=var">test</a>
81<a href="//php.net/file.php?foo=var#bar">test</a>
82<a href="//php.net/some/path/file.php">test</a>
83<a href="//php.net/some/path/file.php?foo">test</a>
84<a href="//php.net/some/path/file.php?foo=var">test</a>
85<a href="//php.net/some/path/file.php?foo=var#bar">test</a>
86<form action="script.php" method="post">
87  <input type="text" name="test1"></input>
88  <input type="text" name="test2" />
89</form>
90';
91output_reset_rewrite_vars();
92*/
93
94echo "*** Test trans sid ***\n";
95ob_start();
96$session_id = 'session-basic3';
97session_id($session_id);
98session_start();
99// Should add session ID to relative URL only for SECURITY
100echo '
101<a href="/">test</a>
102<a href="/path">test</a>
103<a href="/path/">test</a>
104<a href="/path/?foo=var">test</a>
105<a href="../">test</a>
106<a href="../path">test</a>
107<a href="../path/">test</a>
108<a href="../path/?foo=var">test</a>
109
110<a href="/#bar">test</a>
111<a href="/path/#bar">test</a>
112<a href="/path/?foo=var#bar">test</a>
113<a href="../#bar">test</a>
114<a href="../path/#bar">test</a>
115<a href="../path/?foo=var#bar">test</a>
116
117<a href="/?foo">test</a>
118<a href="/?foo#bar">test</a>
119<a href="/?foo=var">test</a>
120<a href="/?foo=var#bar">test</a>
121<a href="../?foo">test</a>
122<a href="../?foo#bar">test</a>
123<a href="../?foo=var">test</a>
124<a href="../?foo=var#bar">test</a>
125
126<a href="file.php">test</a>
127<a href="file.php?foo">test</a>
128<a href="file.php?foo=var">test</a>
129<a href="file.php?foo=var#bar">test</a>
130<a href="../file.php">test</a>
131<a href="../file.php?foo">test</a>
132<a href="../file.php?foo=var">test</a>
133<a href="../file.php?foo=var#bar">test</a>
134
135<a href="http://php.net">test</a>
136<a href="http://php.net/">test</a>
137<a href="http://php.net/#bar">test</a>
138<a href="http://php.net/?foo">test</a>
139<a href="http://php.net/?foo#bar">test</a>
140<a href="http://php.net/?foo=var">test</a>
141<a href="http://php.net/?foo=var#bar">test</a>
142<a href="http://php.net/file.php">test</a>
143<a href="http://php.net/file.php#bar">test</a>
144<a href="http://php.net/file.php?foo">test</a>
145<a href="http://php.net/file.php?foo#bar">test</a>
146<a href="http://php.net/file.php?foo=var">test</a>
147<a href="http://php.net/file.php?foo=var#bar">test</a>
148<a href="http://php.net/some/path/file.php">test</a>
149<a href="http://php.net/some/path/file.php?foo">test</a>
150<a href="http://php.net/some/path/file.php?foo=var">test</a>
151<a href="http://php.net/some/path/file.php?foo=var#bar">test</a>
152
153<a href="https://php.net">test</a>
154<a href="https://php.net/">test</a>
155<a href="https://php.net/?foo=var#bar">test</a>
156<a href="https://php.net/file.php">test</a>
157<a href="https://php.net/file.php?foo=var#bar">test</a>
158<a href="https://php.net/some/path/file.php">test</a>
159<a href="https://php.net/some/path/file.php?foo=var#bar">test</a>
160<a href="https://php.net:8443">test</a>
161<a href="https://php.net:8443/">test</a>
162<a href="https://php.net:8443/?foo=var#bar">test</a>
163<a href="https://php.net:8443/file.php">test</a>
164<a href="https://php.net:8443/file.php?foo=var#bar">test</a>
165<a href="https://php.net:8443/some/path/file.php">test</a>
166<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a>
167
168<a href="//php.net">test</a>
169<a href="//php.net/">test</a>
170<a href="//php.net/#bar">test</a>
171<a href="//php.net/?foo">test</a>
172<a href="//php.net/?foo#bar">test</a>
173<a href="//php.net/?foo=var">test</a>
174<a href="//php.net/?foo=var#bar">test</a>
175<a href="//php.net/file.php">test</a>
176<a href="//php.net/file.php#bar">test</a>
177<a href="//php.net/file.php?foo">test</a>
178<a href="//php.net/file.php?foo#bar">test</a>
179<a href="//php.net/file.php?foo=var">test</a>
180<a href="//php.net/file.php?foo=var#bar">test</a>
181<a href="//php.net/some/path/file.php">test</a>
182<a href="//php.net/some/path/file.php?foo">test</a>
183<a href="//php.net/some/path/file.php?foo=var">test</a>
184<a href="//php.net/some/path/file.php?foo=var#bar">test</a>
185
186<form action="script.php" method="post">
187  <input type="text" name="test1"></input>
188  <input type="text" name="test2" />
189</form>
190<form action="../script.php" method="post">
191  <input type="text" name="test1"></input>
192  <input type="text" name="test2" />
193</form>
194<form action="/path/script.php" method="post">
195  <input type="text" name="test1"></input>
196  <input type="text" name="test2" />
197</form>
198<form action="../path/script.php" method="post">
199  <input type="text" name="test1"></input>
200  <input type="text" name="test2" />
201</form>
202<form method="post" action="http://php.net/script.php">
203  <input type="text" name="test1"></input>
204  <input type="text" name="test2" />
205</form>
206<form method="post" action="https://php.net/script.php">
207  <input type="text" name="test1"></input>
208  <input type="text" name="test2" />
209</form>
210<form method="post" action="//php.net/script.php">
211  <input type="text" name="test1"></input>
212  <input type="text" name="test2" />
213</form>
214';
215var_dump(session_commit());
216
217echo "*** Cleanup ***\n";
218var_dump(session_start());
219var_dump(session_id());
220var_dump(session_destroy());
221
222ob_end_flush();
223?>
224--EXPECT--
225Deprecated: PHP Startup: Disabling session.use_only_cookies INI setting is deprecated in Unknown on line 0
226
227Deprecated: PHP Startup: Enabling session.use_trans_sid INI setting is deprecated in Unknown on line 0
228*** Testing basic session functionality : variation3 use_trans_sid ***
229*** Test trans sid ***
230
231<a href="/?PHPSESSID=session-basic3">test</a>
232<a href="/path?PHPSESSID=session-basic3">test</a>
233<a href="/path/?PHPSESSID=session-basic3">test</a>
234<a href="/path/?foo=var&PHPSESSID=session-basic3">test</a>
235<a href="../?PHPSESSID=session-basic3">test</a>
236<a href="../path?PHPSESSID=session-basic3">test</a>
237<a href="../path/?PHPSESSID=session-basic3">test</a>
238<a href="../path/?foo=var&PHPSESSID=session-basic3">test</a>
239
240<a href="/?PHPSESSID=session-basic3#bar">test</a>
241<a href="/path/?PHPSESSID=session-basic3#bar">test</a>
242<a href="/path/?foo=var&PHPSESSID=session-basic3#bar">test</a>
243<a href="../?PHPSESSID=session-basic3#bar">test</a>
244<a href="../path/?PHPSESSID=session-basic3#bar">test</a>
245<a href="../path/?foo=var&PHPSESSID=session-basic3#bar">test</a>
246
247<a href="/?foo&PHPSESSID=session-basic3">test</a>
248<a href="/?foo&PHPSESSID=session-basic3#bar">test</a>
249<a href="/?foo=var&PHPSESSID=session-basic3">test</a>
250<a href="/?foo=var&PHPSESSID=session-basic3#bar">test</a>
251<a href="../?foo&PHPSESSID=session-basic3">test</a>
252<a href="../?foo&PHPSESSID=session-basic3#bar">test</a>
253<a href="../?foo=var&PHPSESSID=session-basic3">test</a>
254<a href="../?foo=var&PHPSESSID=session-basic3#bar">test</a>
255
256<a href="file.php?PHPSESSID=session-basic3">test</a>
257<a href="file.php?foo&PHPSESSID=session-basic3">test</a>
258<a href="file.php?foo=var&PHPSESSID=session-basic3">test</a>
259<a href="file.php?foo=var&PHPSESSID=session-basic3#bar">test</a>
260<a href="../file.php?PHPSESSID=session-basic3">test</a>
261<a href="../file.php?foo&PHPSESSID=session-basic3">test</a>
262<a href="../file.php?foo=var&PHPSESSID=session-basic3">test</a>
263<a href="../file.php?foo=var&PHPSESSID=session-basic3#bar">test</a>
264
265<a href="http://php.net">test</a>
266<a href="http://php.net/">test</a>
267<a href="http://php.net/#bar">test</a>
268<a href="http://php.net/?foo">test</a>
269<a href="http://php.net/?foo#bar">test</a>
270<a href="http://php.net/?foo=var">test</a>
271<a href="http://php.net/?foo=var#bar">test</a>
272<a href="http://php.net/file.php">test</a>
273<a href="http://php.net/file.php#bar">test</a>
274<a href="http://php.net/file.php?foo">test</a>
275<a href="http://php.net/file.php?foo#bar">test</a>
276<a href="http://php.net/file.php?foo=var">test</a>
277<a href="http://php.net/file.php?foo=var#bar">test</a>
278<a href="http://php.net/some/path/file.php">test</a>
279<a href="http://php.net/some/path/file.php?foo">test</a>
280<a href="http://php.net/some/path/file.php?foo=var">test</a>
281<a href="http://php.net/some/path/file.php?foo=var#bar">test</a>
282
283<a href="https://php.net">test</a>
284<a href="https://php.net/">test</a>
285<a href="https://php.net/?foo=var#bar">test</a>
286<a href="https://php.net/file.php">test</a>
287<a href="https://php.net/file.php?foo=var#bar">test</a>
288<a href="https://php.net/some/path/file.php">test</a>
289<a href="https://php.net/some/path/file.php?foo=var#bar">test</a>
290<a href="https://php.net:8443">test</a>
291<a href="https://php.net:8443/">test</a>
292<a href="https://php.net:8443/?foo=var#bar">test</a>
293<a href="https://php.net:8443/file.php">test</a>
294<a href="https://php.net:8443/file.php?foo=var#bar">test</a>
295<a href="https://php.net:8443/some/path/file.php">test</a>
296<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a>
297
298<a href="//php.net">test</a>
299<a href="//php.net/">test</a>
300<a href="//php.net/#bar">test</a>
301<a href="//php.net/?foo">test</a>
302<a href="//php.net/?foo#bar">test</a>
303<a href="//php.net/?foo=var">test</a>
304<a href="//php.net/?foo=var#bar">test</a>
305<a href="//php.net/file.php">test</a>
306<a href="//php.net/file.php#bar">test</a>
307<a href="//php.net/file.php?foo">test</a>
308<a href="//php.net/file.php?foo#bar">test</a>
309<a href="//php.net/file.php?foo=var">test</a>
310<a href="//php.net/file.php?foo=var#bar">test</a>
311<a href="//php.net/some/path/file.php">test</a>
312<a href="//php.net/some/path/file.php?foo">test</a>
313<a href="//php.net/some/path/file.php?foo=var">test</a>
314<a href="//php.net/some/path/file.php?foo=var#bar">test</a>
315
316<form action="script.php" method="post"><input type="hidden" name="PHPSESSID" value="session-basic3" />
317  <input type="text" name="test1"></input>
318  <input type="text" name="test2" />
319</form>
320<form action="../script.php" method="post"><input type="hidden" name="PHPSESSID" value="session-basic3" />
321  <input type="text" name="test1"></input>
322  <input type="text" name="test2" />
323</form>
324<form action="/path/script.php" method="post"><input type="hidden" name="PHPSESSID" value="session-basic3" />
325  <input type="text" name="test1"></input>
326  <input type="text" name="test2" />
327</form>
328<form action="../path/script.php" method="post"><input type="hidden" name="PHPSESSID" value="session-basic3" />
329  <input type="text" name="test1"></input>
330  <input type="text" name="test2" />
331</form>
332<form method="post" action="http://php.net/script.php">
333  <input type="text" name="test1"></input>
334  <input type="text" name="test2" />
335</form>
336<form method="post" action="https://php.net/script.php">
337  <input type="text" name="test1"></input>
338  <input type="text" name="test2" />
339</form>
340<form method="post" action="//php.net/script.php">
341  <input type="text" name="test1"></input>
342  <input type="text" name="test2" />
343</form>
344bool(true)
345*** Cleanup ***
346bool(true)
347string(14) "session-basic3"
348bool(true)
349