Return to bug64433.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / streams |
1.1 misho 1: --TEST-- 2: Bug #60180 ($_SERVER["PHP_SELF"] incorrect) 3: --SKIPIF-- 4: <?php 5: if(!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"; 8: if(!$res) { 9: die("skip could not open cli server script"); 10: } 11: 12: if (CURL_WRAPPERS_ENABLED) { 13: die("skip curl wrappers used"); 14: } 15: ?> 16: --FILE-- 17: <?php 18: include dirname(__FILE__)."/../../../../sapi/cli/tests/php_cli_server.inc"; 19: php_cli_server_start(file_get_contents(dirname(__FILE__).'/bug64433_srv.inc')); 20: 21: echo file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php"); 22: echo "default\n"; 23: $codes = array(200, 201, 204, 301, 302, 303, 304, 305, 307, 404, 500); 24: foreach($codes as $code) { 25: echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1"); 26: } 27: echo "follow=0\n"; 28: $arr = array('http'=> 29: array( 30: 'follow_location'=>0, 31: ) 32: ); 33: $context = stream_context_create($arr); 34: foreach($codes as $code) { 35: echo "$code: ".file_get_contents("http://".PHP_CLI_SERVER_ADDRESS."/index.php?status=$code&loc=1", false, $context); 36: } 37: echo "follow=1\n"; 38: $arr = array('http'=> 39: array( 40: 'follow_location'=>1, 41: ) 42: ); 43: $context = stream_context_create($arr); 44: foreach($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-- 48: HELLO! 49: default 50: 200: HELLO! 51: 201: HELLO! 52: 204: HELLO! 53: 301: REDIRECTED 54: 302: REDIRECTED 55: 303: REDIRECTED 56: 304: HELLO! 57: 305: HELLO! 58: 307: REDIRECTED 59: 404: HELLO! 60: 500: HELLO! 61: follow=0 62: 200: HELLO! 63: 201: HELLO! 64: 204: HELLO! 65: 301: HELLO! 66: 302: HELLO! 67: 303: HELLO! 68: 304: HELLO! 69: 305: HELLO! 70: 307: HELLO! 71: 404: HELLO! 72: 500: HELLO! 73: follow=1 74: 200: REDIRECTED 75: 201: REDIRECTED 76: 204: REDIRECTED 77: 301: REDIRECTED 78: 302: REDIRECTED 79: 303: REDIRECTED 80: 304: REDIRECTED 81: 305: REDIRECTED 82: 307: REDIRECTED 83: 404: REDIRECTED 84: 500: REDIRECTED 85: 86: