1--TEST--
2URL Rewriter tests
3--INI--
4url_rewriter.tags="a=href,form="
5session.use_only_cookies=0
6session.use_trans_sid=1
7session.use_strict_mode=0
8--FILE--
9<?php
10session_id('id');
11
12$_SERVER['HTTP_HOST'] = 'php.net';
13session_start();
14output_add_rewrite_var('a','b');
15?>
16
17<a></a>
18<a href=""></a>
19<a href="foo"></a>
20<a href="?foo"></a>
21<a href="/foo"></a>
22<a href="foo=bar"></a>
23<a href="foo.php#bar"></a>
24<a href="../foo.php#bar"></a>
25
26<a href="//bad.net/foo"></a>
27<a href="//bad.net/?foo"></a>
28<a href="//bad.net/foo"></a>
29<a href="//bad.net/foo=bar"></a>
30<a href="//bad.net/foo.php#bar"></a>
31<a href="//bad.net/../foo.php#bar"></a>
32
33<a href="//php.net/foo"></a>
34<a href="//php.net/?foo"></a>
35<a href="//php.net//foo"></a>
36<a href="//php.net/foo=bar"></a>
37<a href="//php.net/foo.php#bar"></a>
38
39<a href="http://bad.net/foo"></a>
40<a href="http://bad.net/?foo"></a>
41<a href="http://bad.net/foo"></a>
42<a href="http://bad.net/foo=bar"></a>
43<a href="http://bad.net/foo.php#bar"></a>
44<a href="http://bad.net/../foo.php#bar"></a>
45
46<a href="http://php.net/foo"></a>
47<a href="http://php.net/?foo"></a>
48<a href="http://php.net//foo"></a>
49<a href="http://php.net/foo=bar"></a>
50<a href="http://php.net/foo.php#bar"></a>
51<a href="http://php.net/../foo.php#bar"></a>
52
53<a href="bad://bad.net/foo"></a>
54<a href="bad://bad.net/?foo"></a>
55<a href="bad://bad.net/foo"></a>
56<a href="bad://bad.net/foo=bar"></a>
57<a href="bad://bad.net/foo.php#bar"></a>
58<a href="bad://bad.net/../foo.php#bar"></a>
59
60<a href="bad://php.net/foo"></a>
61<a href="bad://php.net/?foo"></a>
62<a href="bad://php.net//foo"></a>
63<a href="bad://php.net/foo=bar"></a>
64<a href="bad://php.net/foo.php#bar"></a>
65<a href="bad://php.net/../foo.php#bar"></a>
66
67<form></form>
68<form action=""></form>
69<form action="foo.php"></form>
70<form action="//php.net/foo.php"></form>
71<form action="http://php.net/foo.php"></form>
72
73<form action="bad://php.net/foo.php"></form>
74<form action="//bad.net/foo.php"></form>
75<form action="http://php.net/foo.php"></form>
76<form action="bad://php.net/foo.php"></form>
77<form action="//bad.net/foo.php"></form>
78--EXPECT--
79<a></a>
80<a href="?PHPSESSID=id&a=b"></a>
81<a href="foo?PHPSESSID=id&a=b"></a>
82<a href="?foo&PHPSESSID=id&a=b"></a>
83<a href="/foo?PHPSESSID=id&a=b"></a>
84<a href="foo=bar?PHPSESSID=id&a=b"></a>
85<a href="foo.php?PHPSESSID=id&a=b#bar"></a>
86<a href="../foo.php?PHPSESSID=id&a=b#bar"></a>
87
88<a href="//bad.net/foo"></a>
89<a href="//bad.net/?foo"></a>
90<a href="//bad.net/foo"></a>
91<a href="//bad.net/foo=bar"></a>
92<a href="//bad.net/foo.php#bar"></a>
93<a href="//bad.net/../foo.php#bar"></a>
94
95<a href="//php.net/foo?PHPSESSID=id&a=b"></a>
96<a href="//php.net/?foo&PHPSESSID=id&a=b"></a>
97<a href="//php.net//foo?PHPSESSID=id&a=b"></a>
98<a href="//php.net/foo=bar?PHPSESSID=id&a=b"></a>
99<a href="//php.net/foo.php?PHPSESSID=id&a=b#bar"></a>
100
101<a href="http://bad.net/foo"></a>
102<a href="http://bad.net/?foo"></a>
103<a href="http://bad.net/foo"></a>
104<a href="http://bad.net/foo=bar"></a>
105<a href="http://bad.net/foo.php#bar"></a>
106<a href="http://bad.net/../foo.php#bar"></a>
107
108<a href="http://php.net/foo"></a>
109<a href="http://php.net/?foo"></a>
110<a href="http://php.net//foo"></a>
111<a href="http://php.net/foo=bar"></a>
112<a href="http://php.net/foo.php#bar"></a>
113<a href="http://php.net/../foo.php#bar"></a>
114
115<a href="bad://bad.net/foo"></a>
116<a href="bad://bad.net/?foo"></a>
117<a href="bad://bad.net/foo"></a>
118<a href="bad://bad.net/foo=bar"></a>
119<a href="bad://bad.net/foo.php#bar"></a>
120<a href="bad://bad.net/../foo.php#bar"></a>
121
122<a href="bad://php.net/foo"></a>
123<a href="bad://php.net/?foo"></a>
124<a href="bad://php.net//foo"></a>
125<a href="bad://php.net/foo=bar"></a>
126<a href="bad://php.net/foo.php#bar"></a>
127<a href="bad://php.net/../foo.php#bar"></a>
128
129<form><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
130<form action=""><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
131<form action="foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
132<form action="//php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
133<form action="http://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
134
135<form action="bad://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
136<form action="//bad.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
137<form action="http://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
138<form action="bad://php.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
139<form action="//bad.net/foo.php"><input type="hidden" name="PHPSESSID" value="id" /><input type="hidden" name="a" value="b" /></form>
140