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', 0); 15ini_set('session.use_cookies', 0); 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"> 31<form action="//php.net/bar.php" method="get"> 32<form action="http://php.net/bar.php" method="get"> 33<form action="bad://php.net/bar.php" method="get"> 34<form action="//www.php.net/bar.php" method="get"> 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"> </form> 51<form action="//php.net/bar.php" method="get"> </form> 52<form action="http://php.net/bar.php" method="get"> </form> 53<form action="bad://php.net/bar.php" method="get"> </form> 54<form action="//www.php.net/bar.php" method="get"> </form> 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"> </form> 73<form action="//php.net/bar.php" method="get"> </form> 74<form action="http://php.net/bar.php" method="get"> </form> 75<form action="bad://php.net/bar.php" method="get"> </form> 76<form action="//www.php.net/bar.php" method="get"> </form> 77--EXPECTF-- 78Deprecated: ini_set(): Usage of session.trans_sid_hosts INI setting is deprecated in %s on line 5 79 80Deprecated: ini_set(): Disabling session.use_only_cookies INI setting is deprecated in %s on line 6 81Without session 82<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> 83<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 84<a href="//php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 85<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 86<a href="bad://php.net/foo.php"> </a> 87<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 88 89<form method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 90<form action="./foo.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> 91<form action="//php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> 92<form action="http://php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> 93<form action="bad://php.net/bar.php" method="get"> 94<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> 95 96Test use_trans_sid=0 97<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> 98<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 99<a href="//php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 100<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 101<a href="bad://php.net/foo.php"> </a> 102<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 103 104<form method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 105<form action="./foo.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 106<form action="//php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 107<form action="http://php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 108<form action="bad://php.net/bar.php" method="get"> </form> 109<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 110 111 112Deprecated: ini_set(): Enabling session.use_trans_sid INI setting is deprecated in %s on line 50 113Test use_trans_sid=1 114<a href="?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> 115<a href="./foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> 116<a href="//php.net/foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> 117<a href="http://php.net/foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> 118<a href="bad://php.net/foo.php"> </a> 119<a href="//www.php.net/foo.php?PHPSESSID=testid&%3CNAME%3E=%3CVALUE%3E"> </a> 120 121<form method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /><input type="hidden" name="PHPSESSID" value="testid" /> </form> 122<form action="./foo.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /><input type="hidden" name="PHPSESSID" value="testid" /> </form> 123<form action="//php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /><input type="hidden" name="PHPSESSID" value="testid" /> </form> 124<form action="http://php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /><input type="hidden" name="PHPSESSID" value="testid" /> </form> 125<form action="bad://php.net/bar.php" method="get"> </form> 126<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /><input type="hidden" name="PHPSESSID" value="testid" /> </form> 127