1--TEST--
2Test session URL-Rewriting with and without nested output_add_rewrite_var()
3--EXTENSIONS--
4session
5--INI--
6session.trans_sid_tags="a=href,area=href,frame=src,form="
7url_rewriter.tags="a=href,area=href,frame=src,form="
8--FILE--
9<?php
10$testTags = <<<TEST
11
12<a href=""></a>
13<a href="./foo.php"></a>
14
15<a href="//php.net/foo.php"></a>
16<a href="http://php.net/foo.php"></a>
17<a href="bad://php.net/foo.php"></a>
18<a href="//www.php.net/foo.php"></a>
19
20<a href="//session-trans-sid.com/foo.php"></a>
21<a href="http://session-trans-sid.com/foo.php"></a>
22<a href="bad://session-trans-sid.com/foo.php"></a>
23<a href="//www.session-trans-sid.com/foo.php"></a>
24
25<a href="//url-rewriter.com/foo.php"></a>
26<a href="http://url-rewriter.com/foo.php"></a>
27<a href="bad://url-rewriter.com/foo.php"></a>
28<a href="//www.url-rewriter.com/foo.php"></a>
29
30<form action="" method="get"> </form>
31<form action="./foo.php" method="get"></form>
32
33<form action="//php.net/foo.php" method="get"></form>
34<form action="http://php.net/foo.php" method="get"></form>
35<form action="bad://php.net/foo.php" method="get"></form>
36<form action="//www.php.net/foo.php" method="get"></form>
37
38<form action="//session-trans-sid.com/bar.php" method="get"></form>
39<form action="http://session-trans-sid.com/bar.php" method="get"></form>
40<form action="bad://session-trans-sid.com/bar.php" method="get"></form>
41<form action="//www.session-trans-sid.com/bar.php" method="get"></form>
42
43<form action="//url-rewriter.com/bar.php" method="get"></form>
44<form action="http://url-rewriter.com/bar.php" method="get"></form>
45<form action="bad://url-rewriter.com/bar.php" method="get"></form>
46<form action="//www.url-rewriter.com/bar.php" method="get"></form>
47
48TEST;
49
50ob_start();
51
52ini_set('session.trans_sid_hosts', 'session-trans-sid.com');
53ini_set('url_rewriter.hosts', 'url-rewriter.com');
54
55ini_set('session.use_only_cookies', 0);
56ini_set('session.use_cookies', 0);
57ini_set('session.use_strict_mode', 0);
58ini_set('session.use_trans_sid', 1);
59
60session_id('testid');
61session_start();
62
63echo "URL-Rewriting with transparent session id support without output_add_rewrite_var()\n";
64echo $testTags;
65
66ob_flush();
67
68
69output_add_rewrite_var('<name>', '<value>');
70
71echo "\nURL-Rewriting with transparent session id support and output_add_rewrite_var()\n";
72echo $testTags;
73
74ob_end_flush();
75output_reset_rewrite_vars();
76
77
78output_add_rewrite_var('<name2>', '<value2>');
79
80echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n";
81echo $testTags;
82
83--EXPECTF--
84Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
85
86Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 47
87
88Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
89URL-Rewriting with transparent session id support without output_add_rewrite_var()
90
91<a href="?PHPSESSID=testid"></a>
92<a href="./foo.php?PHPSESSID=testid"></a>
93
94<a href="//php.net/foo.php"></a>
95<a href="http://php.net/foo.php"></a>
96<a href="bad://php.net/foo.php"></a>
97<a href="//www.php.net/foo.php"></a>
98
99<a href="//session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
100<a href="http://session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
101<a href="bad://session-trans-sid.com/foo.php"></a>
102<a href="//www.session-trans-sid.com/foo.php"></a>
103
104<a href="//url-rewriter.com/foo.php"></a>
105<a href="http://url-rewriter.com/foo.php"></a>
106<a href="bad://url-rewriter.com/foo.php"></a>
107<a href="//www.url-rewriter.com/foo.php"></a>
108
109<form action="" method="get"><input type="hidden" name="PHPSESSID" value="testid" /> </form>
110<form action="./foo.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
111
112<form action="//php.net/foo.php" method="get"></form>
113<form action="http://php.net/foo.php" method="get"></form>
114<form action="bad://php.net/foo.php" method="get"></form>
115<form action="//www.php.net/foo.php" method="get"></form>
116
117<form action="//session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
118<form action="http://session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
119<form action="bad://session-trans-sid.com/bar.php" method="get"></form>
120<form action="//www.session-trans-sid.com/bar.php" method="get"></form>
121
122<form action="//url-rewriter.com/bar.php" method="get"></form>
123<form action="http://url-rewriter.com/bar.php" method="get"></form>
124<form action="bad://url-rewriter.com/bar.php" method="get"></form>
125<form action="//www.url-rewriter.com/bar.php" method="get"></form>
126
127URL-Rewriting with transparent session id support and output_add_rewrite_var()
128
129<a href="?%3Cname%3E=%3Cvalue%3E&PHPSESSID=testid"></a>
130<a href="./foo.php?%3Cname%3E=%3Cvalue%3E&PHPSESSID=testid"></a>
131
132<a href="//php.net/foo.php"></a>
133<a href="http://php.net/foo.php"></a>
134<a href="bad://php.net/foo.php"></a>
135<a href="//www.php.net/foo.php"></a>
136
137<a href="//session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
138<a href="http://session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
139<a href="bad://session-trans-sid.com/foo.php"></a>
140<a href="//www.session-trans-sid.com/foo.php"></a>
141
142<a href="//url-rewriter.com/foo.php?%3Cname%3E=%3Cvalue%3E"></a>
143<a href="http://url-rewriter.com/foo.php?%3Cname%3E=%3Cvalue%3E"></a>
144<a href="bad://url-rewriter.com/foo.php"></a>
145<a href="//www.url-rewriter.com/foo.php"></a>
146
147<form action="" method="get"><input type="hidden" name="PHPSESSID" value="testid" /><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /> </form>
148<form action="./foo.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /></form>
149
150<form action="//php.net/foo.php" method="get"></form>
151<form action="http://php.net/foo.php" method="get"></form>
152<form action="bad://php.net/foo.php" method="get"></form>
153<form action="//www.php.net/foo.php" method="get"></form>
154
155<form action="//session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
156<form action="http://session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
157<form action="bad://session-trans-sid.com/bar.php" method="get"></form>
158<form action="//www.session-trans-sid.com/bar.php" method="get"></form>
159
160<form action="//url-rewriter.com/bar.php" method="get"><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /></form>
161<form action="http://url-rewriter.com/bar.php" method="get"><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /></form>
162<form action="bad://url-rewriter.com/bar.php" method="get"></form>
163<form action="//www.url-rewriter.com/bar.php" method="get"></form>
164
165URL-Rewriting with transparent session id support without output_add_rewrite_var()
166
167<a href="?PHPSESSID=testid"></a>
168<a href="./foo.php?PHPSESSID=testid"></a>
169
170<a href="//php.net/foo.php"></a>
171<a href="http://php.net/foo.php"></a>
172<a href="bad://php.net/foo.php"></a>
173<a href="//www.php.net/foo.php"></a>
174
175<a href="//session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
176<a href="http://session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
177<a href="bad://session-trans-sid.com/foo.php"></a>
178<a href="//www.session-trans-sid.com/foo.php"></a>
179
180<a href="//url-rewriter.com/foo.php"></a>
181<a href="http://url-rewriter.com/foo.php"></a>
182<a href="bad://url-rewriter.com/foo.php"></a>
183<a href="//www.url-rewriter.com/foo.php"></a>
184
185<form action="" method="get"><input type="hidden" name="PHPSESSID" value="testid" /> </form>
186<form action="./foo.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
187
188<form action="//php.net/foo.php" method="get"></form>
189<form action="http://php.net/foo.php" method="get"></form>
190<form action="bad://php.net/foo.php" method="get"></form>
191<form action="//www.php.net/foo.php" method="get"></form>
192
193<form action="//session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
194<form action="http://session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
195<form action="bad://session-trans-sid.com/bar.php" method="get"></form>
196<form action="//www.session-trans-sid.com/bar.php" method="get"></form>
197
198<form action="//url-rewriter.com/bar.php" method="get"></form>
199<form action="http://url-rewriter.com/bar.php" method="get"></form>
200<form action="bad://url-rewriter.com/bar.php" method="get"></form>
201<form action="//www.url-rewriter.com/bar.php" method="get"></form>
202