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--EXPECT-- 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?%3CNAME%3E=%3CVALUE%3E"> </a> 82<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 83<a href="bad://php.net/foo.php"> </a> 84<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 85 86<form method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 87<form action="./foo.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 88<form action="//php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 89<form action="http://php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 90<form action="bad://php.net/bar.php" method="get"> </a> 91<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </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?%3CNAME%3E=%3CVALUE%3E"> </a> 97<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 98<a href="bad://php.net/foo.php"> </a> 99<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 100 101<form method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 102<form action="./foo.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 103<form action="//php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 104<form action="http://php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 105<form action="bad://php.net/bar.php" method="get"> </a> 106<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 107 108Test use_trans_sid=1 109<a href="?%3CNAME%3E=%3CVALUE%3E"> </a> 110<a href="./foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 111<a href="//php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 112<a href="http://php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 113<a href="bad://php.net/foo.php"> </a> 114<a href="//www.php.net/foo.php?%3CNAME%3E=%3CVALUE%3E"> </a> 115 116<form method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </form> 117<form action="./foo.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 118<form action="//php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 119<form action="http://php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 120<form action="bad://php.net/bar.php" method="get"> </a> 121<form action="//www.php.net/bar.php" method="get"><input type="hidden" name="<NAME>" value="<VALUE>" /> </a> 122