1--TEST-- 2Bug #60180 ($_SERVER["PHP_SELF"] incorrect) 3--SKIPIF-- 4<?php 5if(!file_exists(__DIR__."/../../../../sapi/cli/tests/php_cli_server.inc")) 6 die("skip could not found cli server script"); 7$res = @include __DIR__."/../../../../sapi/cli/tests/php_cli_server.inc"; 8if(!$res) { 9 die("skip could not open cli server script"); 10} 11?> 12--CONFLICTS-- 13server 14--FILE-- 15<?php 16include __DIR__."/../../../../sapi/cli/tests/php_cli_server.inc"; 17php_cli_server_start(file_get_contents(__DIR__.'/bug64433_srv.inc')); 18 19echo file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php"); 20echo "default\n"; 21$codes = array(200, 201, 204, 301, 302, 303, 304, 305, 307, 404, 500); 22foreach($codes as $code) { 23 echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1"); 24} 25echo "follow=0\n"; 26$arr = array('http'=> 27 array( 28 'follow_location'=>0, 29 ) 30 ); 31$context = stream_context_create($arr); 32foreach($codes as $code) { 33 echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); 34} 35echo "follow=1\n"; 36$arr = array('http'=> 37 array( 38 'follow_location'=>1, 39 ) 40 ); 41$context = stream_context_create($arr); 42foreach($codes as $code) { 43 echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); 44} 45?> 46--EXPECT-- 47HELLO! 48default 49200: HELLO! 50201: HELLO! 51204: HELLO! 52301: REDIRECTED 53302: REDIRECTED 54303: REDIRECTED 55304: HELLO! 56305: HELLO! 57307: REDIRECTED 58404: HELLO! 59500: HELLO! 60follow=0 61200: HELLO! 62201: HELLO! 63204: HELLO! 64301: HELLO! 65302: HELLO! 66303: HELLO! 67304: HELLO! 68305: HELLO! 69307: HELLO! 70404: HELLO! 71500: HELLO! 72follow=1 73200: REDIRECTED 74201: REDIRECTED 75204: REDIRECTED 76301: REDIRECTED 77302: REDIRECTED 78303: REDIRECTED 79304: REDIRECTED 80305: REDIRECTED 81307: REDIRECTED 82404: REDIRECTED 83500: REDIRECTED 84