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