1--TEST--
2Test output_add_rewrite_var() function basic feature
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    ob_start();
11// Common setting
12ini_set('url_rewriter.hosts', 'php.net,www.php.net');
13ini_set('session.trans_sid_hosts', 'php.net,www.php.net');
14ini_set('session.use_only_cookies', 1);
15ini_set('session.use_cookies', 1);
16ini_set('session.use_strict_mode', 0);
17session_id('testid');
18
19output_add_rewrite_var('<name>', '<value>');
20?>
21Without session
22<a href=""> </a>
23<a href="./foo.php"> </a>
24<a href="//php.net/foo.php"> </a>
25<a href="http://php.net/foo.php"> </a>
26<a href="bad://php.net/foo.php"> </a>
27<a href="//www.php.net/foo.php"> </a>
28
29<form method="get"> </form>
30<form action="./foo.php" method="get"> </a>
31<form action="//php.net/bar.php" method="get"> </a>
32<form action="http://php.net/bar.php" method="get"> </a>
33<form action="bad://php.net/bar.php" method="get"> </a>
34<form action="//www.php.net/bar.php" method="get"> </a>
35
36<?php
37ini_set('session.use_trans_sid', 0);
38session_start();
39output_add_rewrite_var('<name>', '<value>');
40?>
41Test use_trans_sid=0
42<a href=""> </a>
43<a href="./foo.php"> </a>
44<a href="//php.net/foo.php"> </a>
45<a href="http://php.net/foo.php"> </a>
46<a href="bad://php.net/foo.php"> </a>
47<a href="//www.php.net/foo.php"> </a>
48
49<form method="get"> </form>
50<form action="./foo.php" method="get"> </a>
51<form action="//php.net/bar.php" method="get"> </a>
52<form action="http://php.net/bar.php" method="get"> </a>
53<form action="bad://php.net/bar.php" method="get"> </a>
54<form action="//www.php.net/bar.php" method="get"> </a>
55
56<?php
57session_commit();
58ini_set('session.use_trans_sid', 1);
59output_reset_rewrite_vars();
60session_start();
61output_add_rewrite_var('<NAME>', '<VALUE>');
62?>
63Test use_trans_sid=1
64<a href=""> </a>
65<a href="./foo.php"> </a>
66<a href="//php.net/foo.php"> </a>
67<a href="http://php.net/foo.php"> </a>
68<a href="bad://php.net/foo.php"> </a>
69<a href="//www.php.net/foo.php"> </a>
70
71<form method="get"> </form>
72<form action="./foo.php" method="get"> </a>
73<form action="//php.net/bar.php" method="get"> </a>
74<form action="http://php.net/bar.php" method="get"> </a>
75<form action="bad://php.net/bar.php" method="get"> </a>
76<form action="//www.php.net/bar.php" method="get"> </a>
77--EXPECTF--
78Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5
79Without session
80<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
81<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
82<a href="//php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
83<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
84<a href="bad://php.net/foo.php"> </a>
85<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
86
87<form method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </form>
88<form action="./foo.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
89<form action="//php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
90<form action="http://php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
91<form action="bad://php.net/bar.php" method="get"> </a>
92<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
93
94Test use_trans_sid=0
95<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
96<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
97<a href="//php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
98<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
99<a href="bad://php.net/foo.php"> </a>
100<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
101
102<form method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </form>
103<form action="./foo.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
104<form action="//php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
105<form action="http://php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
106<form action="bad://php.net/bar.php" method="get"> </a>
107<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
108
109
110Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50
111Test use_trans_sid=1
112<a href="?%3CNAME%3E=%3CVALUE%3E"> </a>
113<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
114<a href="//php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
115<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
116<a href="bad://php.net/foo.php"> </a>
117<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a>
118
119<form method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </form>
120<form action="./foo.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
121<form action="//php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
122<form action="http://php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
123<form action="bad://php.net/bar.php" method="get"> </a>
124<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="&lt;NAME&gt;" value="&lt;VALUE&gt;" /> </a>
125