ID: 39095 User updated by: shen dot shenstone at gmail dot com Reported By: shen dot shenstone at gmail dot com Status: Open Bug Type: Streams related Operating System: Windows XP Pro SP2 PHP Version: 5.1.6 New Comment:
>From PHP Document, "max_redirects: The max number of redirects to follow. Value 1 or less means that no redirects are followed. Added in PHP 5.1.0." so i understand it as that if i set max_redirects to 1, it do not follow the redirect("Locatoin:" in header) and return that header. Previous Comments: ------------------------------------------------------------------------ [2006-10-09 14:05:04] shen dot shenstone at gmail dot com Description: ------------ I resubmit this issus because when i add comment to old post, it always return that "Please do not SPAM our bug system." Three Scripts for Test ====================== re1.php ------- <?php header('Location: re2.php'); ?> re2.php ------- <?php header('Location: re3.php'); ?> re3.php ------- <?php echo 'reached.'; ?> TEST SCRIPT =========== <?php $dlp = "http://localhost:8080/re1.php"; $opts = array( 'http' => array( 'max_redirects' => 1, 'method' => "GET", 'header' => "Accept: */*\r\n" . "Accept-Language: en-us\r\n" . "Accept-Encoding: gzip, deflate\r\n" . "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)\r\n" . "Connection: Close\r\n" ) ); $context = stream_context_create($opts); $fp = fopen($dlp, 'r', false, $context); $meta_data = stream_get_meta_data($fp); var_dump($fp); var_dump($meta_data); ?> RESULT(Copy & Paste from Windows Console) ========================================= 1. max_redirects = 1 -------------------- PHP Warning: fopen(): Redirection limit reached, aborting. in D:\webroot\test.p hp on line 18 Warning: fopen(): Redirection limit reached, aborting. in D:\webroot\test.php on line 18 PHP Warning: fopen(http://localhost:8080/re1.php): failed to open stream: No er ror in D:\webroot\test.php on line 18 Warning: fopen(http://localhost:8080/re1.php): failed to open stream: No error i n D:\webroot\test.php on line 18 PHP Warning: stream_get_meta_data(): supplied argument is not a valid stream re source in D:\webroot\test.php on line 19 Warning: stream_get_meta_data(): supplied argument is not a valid stream resourc e in D:\webroot\test.php on line 19 bool(false) bool(false) 2. max_redirects = 2 -------------------- PHP Warning: fopen(): Redirection limit reached, aborting. in D:\webroot\test.p hp on line 18 Warning: fopen(): Redirection limit reached, aborting. in D:\webroot\test.php on line 18 PHP Warning: fopen(http://localhost:8080/re1.php): failed to open stream: No er ror in D:\webroot\test.php on line 18 Warning: fopen(http://localhost:8080/re1.php): failed to open stream: No error i n D:\webroot\test.php on line 18 PHP Warning: stream_get_meta_data(): supplied argument is not a valid stream re source in D:\webroot\test.php on line 19 Warning: stream_get_meta_data(): supplied argument is not a valid stream resourc e in D:\webroot\test.php on line 19 bool(false) bool(false) 3. max_redirects = 3 -------------------- resource(7) of type (stream) array(10) { ["wrapper_data"]=> array(23) { [0]=> string(18) "HTTP/1.1 302 Found" [1]=> string(35) "Date: Mon, 09 Oct 2006 13:37:38 GMT" [2]=> string(14) "Server: Apache" [3]=> string(53) "Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/" [4]=> string(17) "Location: re2.php" [5]=> string(17) "Content-Length: 0" [6]=> string(17) "Connection: close" [7]=> string(39) "Content-Type: text/html; charset=GB2312" [8]=> string(18) "HTTP/1.1 302 Found" [9]=> string(35) "Date: Mon, 09 Oct 2006 13:37:38 GMT" [10]=> string(14) "Server: Apache" [11]=> string(53) "Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/" [12]=> string(17) "Location: re3.php" [13]=> string(17) "Content-Length: 0" [14]=> string(17) "Connection: close" [15]=> string(39) "Content-Type: text/html; charset=GB2312" [16]=> string(15) "HTTP/1.1 200 OK" [17]=> string(35) "Date: Mon, 09 Oct 2006 13:37:38 GMT" [18]=> string(14) "Server: Apache" [19]=> string(53) "Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/" [20]=> string(17) "Content-Length: 8" [21]=> string(17) "Connection: close" [22]=> string(39) "Content-Type: text/html; charset=GB2312" } ["wrapper_type"]=> string(4) "http" ["stream_type"]=> string(10) "tcp_socket" ["mode"]=> string(2) "r+" ["unread_bytes"]=> int(8) ["seekable"]=> bool(false) ["uri"]=> string(29) "http://localhost:8080/re1.php" ["timed_out"]=> bool(false) ["blocked"]=> bool(true) ["eof"]=> bool(false) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39095&edit=1