1--TEST-- 2Bug #60180 ($_SERVER["PHP_SELF"] incorrect) 3--SKIPIF-- 4<?php 5if(!file_exists(dirname(__FILE__)."/../../../../sapi/cli/tests/php_cli_server.inc")) 6 die("skip could not found cli server script"); 7$res = @include dirname(__FILE__)."/../../../../sapi/cli/tests/php_cli_server.inc"; 8if(!$res) { 9 die("skip could not open cli server script"); 10} 11 12if (CURL_WRAPPERS_ENABLED) { 13 die("skip curl wrappers used"); 14} 15?> 16--FILE-- 17<?php 18include dirname(__FILE__)."/../../../../sapi/cli/tests/php_cli_server.inc"; 19php_cli_server_start(file_get_contents(dirname(__FILE__).'/bug64433_srv.inc')); 20 21echo file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php"); 22echo "default\n"; 23$codes = array(200, 201, 204, 301, 302, 303, 304, 305, 307, 404, 500); 24foreach($codes as $code) { 25 echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1"); 26} 27echo "follow=0\n"; 28$arr = array('http'=> 29 array( 30 'follow_location'=>0, 31 ) 32 ); 33$context = stream_context_create($arr); 34foreach($codes as $code) { 35 echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); 36} 37echo "follow=1\n"; 38$arr = array('http'=> 39 array( 40 'follow_location'=>1, 41 ) 42 ); 43$context = stream_context_create($arr); 44foreach($codes as $code) { 45 echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); 46} 47--EXPECT-- 48HELLO! 49default 50200: HELLO! 51201: HELLO! 52204: HELLO! 53301: REDIRECTED 54302: REDIRECTED 55303: REDIRECTED 56304: HELLO! 57305: HELLO! 58307: REDIRECTED 59404: HELLO! 60500: HELLO! 61follow=0 62200: HELLO! 63201: HELLO! 64204: HELLO! 65301: HELLO! 66302: HELLO! 67303: HELLO! 68304: HELLO! 69305: HELLO! 70307: HELLO! 71404: HELLO! 72500: HELLO! 73follow=1 74200: REDIRECTED 75201: REDIRECTED 76204: REDIRECTED 77301: REDIRECTED 78302: REDIRECTED 79303: REDIRECTED 80304: REDIRECTED 81305: REDIRECTED 82307: REDIRECTED 83404: REDIRECTED 84500: REDIRECTED 85 86 87