1--TEST--
2Test session and output_add_rewrite_var() URL-Rewriting independently
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', 1);
56ini_set('session.use_cookies', 1);
57ini_set('session.use_strict_mode', 1);
58ini_set('session.use_trans_sid', 0);
59
60output_add_rewrite_var('<name>', '<value>');
61
62echo "URL-Rewriting with output_add_rewrite_var() without transparent session id support\n";
63echo $testTags;
64
65ob_end_flush();
66
67
68ini_set('session.use_only_cookies', 0);
69ini_set('session.use_cookies', 0);
70ini_set('session.use_strict_mode', 0);
71ini_set('session.use_trans_sid', 1);
72
73session_id('testid');
74session_start();
75
76echo "\nURL-Rewriting with transparent session id support without output_add_rewrite_var()\n";
77echo $testTags;
78
79--EXPECTF--
80Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 44
81URL-Rewriting with output_add_rewrite_var() without transparent session id support
82
83<a href="?%3Cname%3E=%3Cvalue%3E"></a>
84<a href="./foo.php?%3Cname%3E=%3Cvalue%3E"></a>
85
86<a href="//php.net/foo.php"></a>
87<a href="http://php.net/foo.php"></a>
88<a href="bad://php.net/foo.php"></a>
89<a href="//www.php.net/foo.php"></a>
90
91<a href="//session-trans-sid.com/foo.php"></a>
92<a href="http://session-trans-sid.com/foo.php"></a>
93<a href="bad://session-trans-sid.com/foo.php"></a>
94<a href="//www.session-trans-sid.com/foo.php"></a>
95
96<a href="//url-rewriter.com/foo.php?%3Cname%3E=%3Cvalue%3E"></a>
97<a href="http://url-rewriter.com/foo.php?%3Cname%3E=%3Cvalue%3E"></a>
98<a href="bad://url-rewriter.com/foo.php"></a>
99<a href="//www.url-rewriter.com/foo.php"></a>
100
101<form action="" method="get"><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /> </form>
102<form action="./foo.php" method="get"><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /></form>
103
104<form action="//php.net/foo.php" method="get"></form>
105<form action="http://php.net/foo.php" method="get"></form>
106<form action="bad://php.net/foo.php" method="get"></form>
107<form action="//www.php.net/foo.php" method="get"></form>
108
109<form action="//session-trans-sid.com/bar.php" method="get"></form>
110<form action="http://session-trans-sid.com/bar.php" method="get"></form>
111<form action="bad://session-trans-sid.com/bar.php" method="get"></form>
112<form action="//www.session-trans-sid.com/bar.php" method="get"></form>
113
114<form action="//url-rewriter.com/bar.php" method="get"><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /></form>
115<form action="http://url-rewriter.com/bar.php" method="get"><input type="hidden" name="&lt;name&gt;" value="&lt;value&gt;" /></form>
116<form action="bad://url-rewriter.com/bar.php" method="get"></form>
117<form action="//www.url-rewriter.com/bar.php" method="get"></form>
118
119Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 60
120
121Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 63
122
123URL-Rewriting with transparent session id support without output_add_rewrite_var()
124
125<a href="?PHPSESSID=testid"></a>
126<a href="./foo.php?PHPSESSID=testid"></a>
127
128<a href="//php.net/foo.php"></a>
129<a href="http://php.net/foo.php"></a>
130<a href="bad://php.net/foo.php"></a>
131<a href="//www.php.net/foo.php"></a>
132
133<a href="//session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
134<a href="http://session-trans-sid.com/foo.php?PHPSESSID=testid"></a>
135<a href="bad://session-trans-sid.com/foo.php"></a>
136<a href="//www.session-trans-sid.com/foo.php"></a>
137
138<a href="//url-rewriter.com/foo.php"></a>
139<a href="http://url-rewriter.com/foo.php"></a>
140<a href="bad://url-rewriter.com/foo.php"></a>
141<a href="//www.url-rewriter.com/foo.php"></a>
142
143<form action="" method="get"><input type="hidden" name="PHPSESSID" value="testid" /> </form>
144<form action="./foo.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
145
146<form action="//php.net/foo.php" method="get"></form>
147<form action="http://php.net/foo.php" method="get"></form>
148<form action="bad://php.net/foo.php" method="get"></form>
149<form action="//www.php.net/foo.php" method="get"></form>
150
151<form action="//session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
152<form action="http://session-trans-sid.com/bar.php" method="get"><input type="hidden" name="PHPSESSID" value="testid" /></form>
153<form action="bad://session-trans-sid.com/bar.php" method="get"></form>
154<form action="//www.session-trans-sid.com/bar.php" method="get"></form>
155
156<form action="//url-rewriter.com/bar.php" method="get"></form>
157<form action="http://url-rewriter.com/bar.php" method="get"></form>
158<form action="bad://url-rewriter.com/bar.php" method="get"></form>
159<form action="//www.url-rewriter.com/bar.php" method="get"></form>
160