1--TEST-- 2Test basic function : variation3 use_trans_sid 3--INI-- 4session.use_strict_mode=0 5session.use_only_cookies=0 6session.use_trans_sid=1 7session.save_handler=files 8session.hash_bits_per_character=4 9session.hash_function=0 10session.gc_probability=1 11session.gc_divisor=1000 12session.gc_maxlifetime=300 13session.save_path= 14session.name=PHPSESSID 15url_rewriter.hosts= 16--SKIPIF-- 17<?php include('skipif.inc'); ?> 18--FILE-- 19<?php 20 21ob_start(); 22 23echo "*** Testing basic session functionality : variation3 use_trans_sid ***\n"; 24 25/* 26echo "*** test output_add_rewrite_var() ***\n"; 27output_add_rewrite_var('var', 'value'); 28echo ' 29<a href="/">test</a> 30<a href="/#bar">test</a> 31<a href="/?foo">test</a> 32<a href="/?foo#bar">test</a> 33<a href="/?foo=var">test</a> 34<a href="/?foo=var#bar">test</a> 35<a href="file.php">test</a> 36<a href="file.php?foo">test</a> 37<a href="file.php?foo=var">test</a> 38<a href="http://php.net">test</a> 39<a href="http://php.net/">test</a> 40<a href="http://php.net/#bar">test</a> 41<a href="http://php.net/?foo">test</a> 42<a href="http://php.net/?foo#bar">test</a> 43<a href="http://php.net/?foo=var">test</a> 44<a href="http://php.net/?foo=var#bar">test</a> 45<a href="http://php.net/file.php">test</a> 46<a href="http://php.net/file.php#bar">test</a> 47<a href="http://php.net/file.php?foo">test</a> 48<a href="http://php.net/file.php?foo#bar">test</a> 49<a href="http://php.net/file.php?foo=var">test</a> 50<a href="http://php.net/file.php?foo=var#bar">test</a> 51<a href="http://php.net/some/path/file.php">test</a> 52<a href="http://php.net/some/path/file.php?foo">test</a> 53<a href="http://php.net/some/path/file.php?foo=var">test</a> 54<a href="http://php.net/some/path/file.php?foo=var#bar">test</a> 55<a href="https://php.net">test</a> 56<a href="https://php.net/">test</a> 57<a href="https://php.net/?foo=var#bar">test</a> 58<a href="https://php.net/file.php">test</a> 59<a href="https://php.net/file.php?foo=var#bar">test</a> 60<a href="https://php.net/some/path/file.php">test</a> 61<a href="https://php.net/some/path/file.php?foo=var#bar">test</a> 62<a href="https://php.net:8443">test</a> 63<a href="https://php.net:8443/">test</a> 64<a href="https://php.net:8443/?foo=var#bar">test</a> 65<a href="https://php.net:8443/file.php">test</a> 66<a href="https://php.net:8443/file.php?foo=var#bar">test</a> 67<a href="https://php.net:8443/some/path/file.php">test</a> 68<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a> 69<a href="//php.net">test</a> 70<a href="//php.net/">test</a> 71<a href="//php.net/#bar">test</a> 72<a href="//php.net/?foo">test</a> 73<a href="//php.net/?foo#bar">test</a> 74<a href="//php.net/?foo=var">test</a> 75<a href="//php.net/?foo=var#bar">test</a> 76<a href="//php.net/file.php">test</a> 77<a href="//php.net/file.php#bar">test</a> 78<a href="//php.net/file.php?foo">test</a> 79<a href="//php.net/file.php?foo#bar">test</a> 80<a href="//php.net/file.php?foo=var">test</a> 81<a href="//php.net/file.php?foo=var#bar">test</a> 82<a href="//php.net/some/path/file.php">test</a> 83<a href="//php.net/some/path/file.php?foo">test</a> 84<a href="//php.net/some/path/file.php?foo=var">test</a> 85<a href="//php.net/some/path/file.php?foo=var#bar">test</a> 86<form action="script.php" method="post"> 87 <input type="text" name="test1"></input> 88 <input type="text" name="test2" /> 89</form> 90'; 91output_reset_rewrite_vars(); 92*/ 93 94echo "*** Test trans sid ***\n"; 95ob_start(); 96$session_id = 'testid'; 97session_id($session_id); 98session_start(); 99// Should add session ID to relative URL only for SECURITY 100echo ' 101<a href="/">test</a> 102<a href="/path">test</a> 103<a href="/path/">test</a> 104<a href="/path/?foo=var">test</a> 105<a href="../">test</a> 106<a href="../path">test</a> 107<a href="../path/">test</a> 108<a href="../path/?foo=var">test</a> 109 110<a href="/#bar">test</a> 111<a href="/path/#bar">test</a> 112<a href="/path/?foo=var#bar">test</a> 113<a href="../#bar">test</a> 114<a href="../path/#bar">test</a> 115<a href="../path/?foo=var#bar">test</a> 116 117<a href="/?foo">test</a> 118<a href="/?foo#bar">test</a> 119<a href="/?foo=var">test</a> 120<a href="/?foo=var#bar">test</a> 121<a href="../?foo">test</a> 122<a href="../?foo#bar">test</a> 123<a href="../?foo=var">test</a> 124<a href="../?foo=var#bar">test</a> 125 126<a href="file.php">test</a> 127<a href="file.php?foo">test</a> 128<a href="file.php?foo=var">test</a> 129<a href="file.php?foo=var#bar">test</a> 130<a href="../file.php">test</a> 131<a href="../file.php?foo">test</a> 132<a href="../file.php?foo=var">test</a> 133<a href="../file.php?foo=var#bar">test</a> 134 135<a href="http://php.net">test</a> 136<a href="http://php.net/">test</a> 137<a href="http://php.net/#bar">test</a> 138<a href="http://php.net/?foo">test</a> 139<a href="http://php.net/?foo#bar">test</a> 140<a href="http://php.net/?foo=var">test</a> 141<a href="http://php.net/?foo=var#bar">test</a> 142<a href="http://php.net/file.php">test</a> 143<a href="http://php.net/file.php#bar">test</a> 144<a href="http://php.net/file.php?foo">test</a> 145<a href="http://php.net/file.php?foo#bar">test</a> 146<a href="http://php.net/file.php?foo=var">test</a> 147<a href="http://php.net/file.php?foo=var#bar">test</a> 148<a href="http://php.net/some/path/file.php">test</a> 149<a href="http://php.net/some/path/file.php?foo">test</a> 150<a href="http://php.net/some/path/file.php?foo=var">test</a> 151<a href="http://php.net/some/path/file.php?foo=var#bar">test</a> 152 153<a href="https://php.net">test</a> 154<a href="https://php.net/">test</a> 155<a href="https://php.net/?foo=var#bar">test</a> 156<a href="https://php.net/file.php">test</a> 157<a href="https://php.net/file.php?foo=var#bar">test</a> 158<a href="https://php.net/some/path/file.php">test</a> 159<a href="https://php.net/some/path/file.php?foo=var#bar">test</a> 160<a href="https://php.net:8443">test</a> 161<a href="https://php.net:8443/">test</a> 162<a href="https://php.net:8443/?foo=var#bar">test</a> 163<a href="https://php.net:8443/file.php">test</a> 164<a href="https://php.net:8443/file.php?foo=var#bar">test</a> 165<a href="https://php.net:8443/some/path/file.php">test</a> 166<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a> 167 168<a href="//php.net">test</a> 169<a href="//php.net/">test</a> 170<a href="//php.net/#bar">test</a> 171<a href="//php.net/?foo">test</a> 172<a href="//php.net/?foo#bar">test</a> 173<a href="//php.net/?foo=var">test</a> 174<a href="//php.net/?foo=var#bar">test</a> 175<a href="//php.net/file.php">test</a> 176<a href="//php.net/file.php#bar">test</a> 177<a href="//php.net/file.php?foo">test</a> 178<a href="//php.net/file.php?foo#bar">test</a> 179<a href="//php.net/file.php?foo=var">test</a> 180<a href="//php.net/file.php?foo=var#bar">test</a> 181<a href="//php.net/some/path/file.php">test</a> 182<a href="//php.net/some/path/file.php?foo">test</a> 183<a href="//php.net/some/path/file.php?foo=var">test</a> 184<a href="//php.net/some/path/file.php?foo=var#bar">test</a> 185 186<form action="script.php" method="post"> 187 <input type="text" name="test1"></input> 188 <input type="text" name="test2" /> 189</form> 190<form action="../script.php" method="post"> 191 <input type="text" name="test1"></input> 192 <input type="text" name="test2" /> 193</form> 194<form action="/path/script.php" method="post"> 195 <input type="text" name="test1"></input> 196 <input type="text" name="test2" /> 197</form> 198<form action="../path/script.php" method="post"> 199 <input type="text" name="test1"></input> 200 <input type="text" name="test2" /> 201</form> 202<form method="post" action="http://php.net/script.php"> 203 <input type="text" name="test1"></input> 204 <input type="text" name="test2" /> 205</form> 206<form method="post" action="https://php.net/script.php"> 207 <input type="text" name="test1"></input> 208 <input type="text" name="test2" /> 209</form> 210<form method="post" action="//php.net/script.php"> 211 <input type="text" name="test1"></input> 212 <input type="text" name="test2" /> 213</form> 214'; 215var_dump(session_commit()); 216 217echo "*** Cleanup ***\n"; 218var_dump(session_start()); 219var_dump(session_id()); 220var_dump(session_destroy()); 221 222ob_end_flush(); 223?> 224--EXPECT-- 225*** Testing basic session functionality : variation3 use_trans_sid *** 226*** Test trans sid *** 227 228<a href="/?PHPSESSID=testid">test</a> 229<a href="/path?PHPSESSID=testid">test</a> 230<a href="/path/?PHPSESSID=testid">test</a> 231<a href="/path/?foo=var&PHPSESSID=testid">test</a> 232<a href="../?PHPSESSID=testid">test</a> 233<a href="../path?PHPSESSID=testid">test</a> 234<a href="../path/?PHPSESSID=testid">test</a> 235<a href="../path/?foo=var&PHPSESSID=testid">test</a> 236 237<a href="/?PHPSESSID=testid#bar">test</a> 238<a href="/path/?PHPSESSID=testid#bar">test</a> 239<a href="/path/?foo=var&PHPSESSID=testid#bar">test</a> 240<a href="../?PHPSESSID=testid#bar">test</a> 241<a href="../path/?PHPSESSID=testid#bar">test</a> 242<a href="../path/?foo=var&PHPSESSID=testid#bar">test</a> 243 244<a href="/?foo&PHPSESSID=testid">test</a> 245<a href="/?foo&PHPSESSID=testid#bar">test</a> 246<a href="/?foo=var&PHPSESSID=testid">test</a> 247<a href="/?foo=var&PHPSESSID=testid#bar">test</a> 248<a href="../?foo&PHPSESSID=testid">test</a> 249<a href="../?foo&PHPSESSID=testid#bar">test</a> 250<a href="../?foo=var&PHPSESSID=testid">test</a> 251<a href="../?foo=var&PHPSESSID=testid#bar">test</a> 252 253<a href="file.php?PHPSESSID=testid">test</a> 254<a href="file.php?foo&PHPSESSID=testid">test</a> 255<a href="file.php?foo=var&PHPSESSID=testid">test</a> 256<a href="file.php?foo=var&PHPSESSID=testid#bar">test</a> 257<a href="../file.php?PHPSESSID=testid">test</a> 258<a href="../file.php?foo&PHPSESSID=testid">test</a> 259<a href="../file.php?foo=var&PHPSESSID=testid">test</a> 260<a href="../file.php?foo=var&PHPSESSID=testid#bar">test</a> 261 262<a href="http://php.net">test</a> 263<a href="http://php.net/">test</a> 264<a href="http://php.net/#bar">test</a> 265<a href="http://php.net/?foo">test</a> 266<a href="http://php.net/?foo#bar">test</a> 267<a href="http://php.net/?foo=var">test</a> 268<a href="http://php.net/?foo=var#bar">test</a> 269<a href="http://php.net/file.php">test</a> 270<a href="http://php.net/file.php#bar">test</a> 271<a href="http://php.net/file.php?foo">test</a> 272<a href="http://php.net/file.php?foo#bar">test</a> 273<a href="http://php.net/file.php?foo=var">test</a> 274<a href="http://php.net/file.php?foo=var#bar">test</a> 275<a href="http://php.net/some/path/file.php">test</a> 276<a href="http://php.net/some/path/file.php?foo">test</a> 277<a href="http://php.net/some/path/file.php?foo=var">test</a> 278<a href="http://php.net/some/path/file.php?foo=var#bar">test</a> 279 280<a href="https://php.net">test</a> 281<a href="https://php.net/">test</a> 282<a href="https://php.net/?foo=var#bar">test</a> 283<a href="https://php.net/file.php">test</a> 284<a href="https://php.net/file.php?foo=var#bar">test</a> 285<a href="https://php.net/some/path/file.php">test</a> 286<a href="https://php.net/some/path/file.php?foo=var#bar">test</a> 287<a href="https://php.net:8443">test</a> 288<a href="https://php.net:8443/">test</a> 289<a href="https://php.net:8443/?foo=var#bar">test</a> 290<a href="https://php.net:8443/file.php">test</a> 291<a href="https://php.net:8443/file.php?foo=var#bar">test</a> 292<a href="https://php.net:8443/some/path/file.php">test</a> 293<a href="https://php.net:8443/some/path/file.php?foo=var#bar">test</a> 294 295<a href="//php.net">test</a> 296<a href="//php.net/">test</a> 297<a href="//php.net/#bar">test</a> 298<a href="//php.net/?foo">test</a> 299<a href="//php.net/?foo#bar">test</a> 300<a href="//php.net/?foo=var">test</a> 301<a href="//php.net/?foo=var#bar">test</a> 302<a href="//php.net/file.php">test</a> 303<a href="//php.net/file.php#bar">test</a> 304<a href="//php.net/file.php?foo">test</a> 305<a href="//php.net/file.php?foo#bar">test</a> 306<a href="//php.net/file.php?foo=var">test</a> 307<a href="//php.net/file.php?foo=var#bar">test</a> 308<a href="//php.net/some/path/file.php">test</a> 309<a href="//php.net/some/path/file.php?foo">test</a> 310<a href="//php.net/some/path/file.php?foo=var">test</a> 311<a href="//php.net/some/path/file.php?foo=var#bar">test</a> 312 313<form action="script.php" method="post"><input type="hidden" name="PHPSESSID" value="testid" /> 314 <input type="text" name="test1"></input> 315 <input type="text" name="test2" /> 316</form> 317<form action="../script.php" method="post"><input type="hidden" name="PHPSESSID" value="testid" /> 318 <input type="text" name="test1"></input> 319 <input type="text" name="test2" /> 320</form> 321<form action="/path/script.php" method="post"><input type="hidden" name="PHPSESSID" value="testid" /> 322 <input type="text" name="test1"></input> 323 <input type="text" name="test2" /> 324</form> 325<form action="../path/script.php" method="post"><input type="hidden" name="PHPSESSID" value="testid" /> 326 <input type="text" name="test1"></input> 327 <input type="text" name="test2" /> 328</form> 329<form method="post" action="http://php.net/script.php"> 330 <input type="text" name="test1"></input> 331 <input type="text" name="test2" /> 332</form> 333<form method="post" action="https://php.net/script.php"> 334 <input type="text" name="test1"></input> 335 <input type="text" name="test2" /> 336</form> 337<form method="post" action="//php.net/script.php"> 338 <input type="text" name="test1"></input> 339 <input type="text" name="test2" /> 340</form> 341bool(true) 342*** Cleanup *** 343bool(true) 344string(6) "testid" 345bool(true) 346