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--EXPECT-- 46HELLO! 47default 48200: HELLO! 49201: HELLO! 50204: HELLO! 51301: REDIRECTED 52302: REDIRECTED 53303: REDIRECTED 54304: HELLO! 55305: HELLO! 56307: REDIRECTED 57404: HELLO! 58500: HELLO! 59follow=0 60200: HELLO! 61201: HELLO! 62204: HELLO! 63301: HELLO! 64302: HELLO! 65303: HELLO! 66304: HELLO! 67305: HELLO! 68307: HELLO! 69404: HELLO! 70500: HELLO! 71follow=1 72200: REDIRECTED 73201: REDIRECTED 74204: REDIRECTED 75301: REDIRECTED 76302: REDIRECTED 77303: REDIRECTED 78304: REDIRECTED 79305: REDIRECTED 80307: REDIRECTED 81404: REDIRECTED 82500: REDIRECTED 83