#47687 [NEW]: header("Location:") changing HTTP status
From: make dot fire at gmail dot com Operating system: windows server 2008 PHP version: 5.3CVS-2009-03-17 (snap) PHP Bug Type: HTTP related Bug description: header("Location:") changing HTTP status Description: This bug is identical to bug #25044. When setting the "Location" HTTP header using the header() function, PHP automatically changes the HTTP response status to "302 Found", Whether other status codes is already set or not. Reproduce code: --- file1.php: http://www.php.net/";); exit; ?> file2.php: http://www.php.net/";); exit; ?> Expected result: HTTP Response: file1.php: HTTP/1.1 201 Created Location: http://www.php.net/ file2.php: HTTP/1.1 303 See Other Location: http://www.php.net/ Actual result: -- HTTP Response: file1.php: HTTP/1.0 302 Found Location: http://www.php.net/ file2.php: HTTP/1.0 302 Found Location: http://www.php.net/ -- Edit bug report at http://bugs.php.net/?id=47687&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47687&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47687&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47687&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47687&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47687&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47687&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47687&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47687&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47687&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47687&r=support Expected behavior: http://bugs.php.net/fix.php?id=47687&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47687&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47687&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47687&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47687&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=47687&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47687&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47687&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47687&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47687&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47687&r=mysqlcfg
#47687 [Opn]: header("Location:") changing HTTP status
ID: 47687 User updated by: make dot fire at gmail dot com Reported By: make dot fire at gmail dot com Status: Open Bug Type: HTTP related Operating System: windows server 2008 PHP Version: 5.3CVS-2009-03-17 (snap) New Comment: And, the workaround in #25044 is not working, the code: header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other'); or header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other', true, 303); will result same response header: HTTP/1.0 302 Found Location: http://www.php.net/ Previous Comments: -------- [2009-03-17 09:54:21] make dot fire at gmail dot com Description: This bug is identical to bug #25044. When setting the "Location" HTTP header using the header() function, PHP automatically changes the HTTP response status to "302 Found", Whether other status codes is already set or not. Reproduce code: --- file1.php: http://www.php.net/";); exit; ?> file2.php: http://www.php.net/";); exit; ?> Expected result: HTTP Response: file1.php: HTTP/1.1 201 Created Location: http://www.php.net/ file2.php: HTTP/1.1 303 See Other Location: http://www.php.net/ Actual result: -- HTTP Response: file1.php: HTTP/1.0 302 Found Location: http://www.php.net/ file2.php: HTTP/1.0 302 Found Location: http://www.php.net/ -- Edit this bug report at http://bugs.php.net/?id=47687&edit=1
#47687 [Fbk->Opn]: header("Location:") changing HTTP status
ID: 47687 User updated by: make dot fire at gmail dot com Reported By: make dot fire at gmail dot com -Status: Feedback +Status: Open Bug Type: HTTP related -Operating System: windows server 2008 +Operating System: windows server vista PHP Version: 5.3CVS-2009-03-17 (snap) New Comment: I try to use the lastest snapshots (PHP 5.3 (5.3.0beta2-dev),VC9 x86 Non Thread Safe (2009-Mar-17 13:00:00)),got the same result. some infomation from phpinfo(): System: Windows NT 6.0 build 6001 (Windows Vista Ultimate Edition Service Pack 1) i586 Build Date: Mar 17 2009 12:55:17 Compiler: MSVC9 (Visual C++ 2008) Architecture: x86 Server API: CGI/FastCGI CGI section: Directive Local Value Master Value cgi.discard_path0 0 cgi.fix_pathinfo1 1 cgi.force_redirect 0 0 cgi.nph 0 0 cgi.redirect_status_env no valueno value cgi.rfc2616_headers 0 0 fastcgi.impersonate 1 1 fastcgi.logging 1 1 webserver is IIS7, PHP run in FastCGI mode(use php-cgi.exe). I use HttpWatch to catch response header, when use code: http://www.php.net/";); exit; ?> the status line in response is: HTTP/1.1 302 Redirect and when use code: the status line in response is: HTTP/1.1 303 See Other Previous Comments: [2009-03-17 11:03:24] j...@php.net First of all, both of your examples work fine for me and produce the expected results. You did not mention what web server you are using? And exactly what PHP version are you using? [2009-03-17 10:01:55] make dot fire at gmail dot com And, the workaround in #25044 is not working, the code: header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other'); or header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other', true, 303); will result same response header: HTTP/1.0 302 Found Location: http://www.php.net/ ------------ [2009-03-17 09:54:21] make dot fire at gmail dot com Description: This bug is identical to bug #25044. When setting the "Location" HTTP header using the header() function, PHP automatically changes the HTTP response status to "302 Found", Whether other status codes is already set or not. Reproduce code: --- file1.php: http://www.php.net/";); exit; ?> file2.php: http://www.php.net/";); exit; ?> Expected result: HTTP Response: file1.php: HTTP/1.1 201 Created Location: http://www.php.net/ file2.php: HTTP/1.1 303 See Other Location: http://www.php.net/ Actual result: -- HTTP Response: file1.php: HTTP/1.0 302 Found Location: http://www.php.net/ file2.php: HTTP/1.0 302 Found Location: http://www.php.net/ -- Edit this bug report at http://bugs.php.net/?id=47687&edit=1
#47687 [Opn]: header("Location:") changing HTTP status
ID: 47687 User updated by: make dot fire at gmail dot com Reported By: make dot fire at gmail dot com Status: Open Bug Type: HTTP related Operating System: windows server vista PHP Version: 5.3CVS-2009-03-17 (snap) New Comment: When run php-cgi.exe in command line, the result is expected: D:\project\www>php-cgi ./test.php Status: 303 See Other Location: http://www.php.net/ Content-type: text/html; charset=utf-8 test.php: http://www.php.net/";); exit; ?> but visit same file throuth browser and webserver (use http://localhost/test.php) will get 302 status code. Previous Comments: [2009-03-17 13:56:28] make dot fire at gmail dot com I try to use the lastest snapshots (PHP 5.3 (5.3.0beta2-dev),VC9 x86 Non Thread Safe (2009-Mar-17 13:00:00)),got the same result. some infomation from phpinfo(): System: Windows NT 6.0 build 6001 (Windows Vista Ultimate Edition Service Pack 1) i586 Build Date: Mar 17 2009 12:55:17 Compiler: MSVC9 (Visual C++ 2008) Architecture: x86 Server API: CGI/FastCGI CGI section: Directive Local Value Master Value cgi.discard_path0 0 cgi.fix_pathinfo1 1 cgi.force_redirect 0 0 cgi.nph 0 0 cgi.redirect_status_env no valueno value cgi.rfc2616_headers 0 0 fastcgi.impersonate 1 1 fastcgi.logging 1 1 webserver is IIS7, PHP run in FastCGI mode(use php-cgi.exe). I use HttpWatch to catch response header, when use code: http://www.php.net/";); exit; ?> the status line in response is: HTTP/1.1 302 Redirect and when use code: the status line in response is: HTTP/1.1 303 See Other [2009-03-17 11:03:24] j...@php.net First of all, both of your examples work fine for me and produce the expected results. You did not mention what web server you are using? And exactly what PHP version are you using? [2009-03-17 10:01:55] make dot fire at gmail dot com And, the workaround in #25044 is not working, the code: header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other'); or header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other', true, 303); will result same response header: HTTP/1.0 302 Found Location: http://www.php.net/ -------------------- [2009-03-17 09:54:21] make dot fire at gmail dot com Description: This bug is identical to bug #25044. When setting the "Location" HTTP header using the header() function, PHP automatically changes the HTTP response status to "302 Found", Whether other status codes is already set or not. Reproduce code: --- file1.php: http://www.php.net/";); exit; ?> file2.php: http://www.php.net/";); exit; ?> Expected result: HTTP Response: file1.php: HTTP/1.1 201 Created Location: http://www.php.net/ file2.php: HTTP/1.1 303 See Other Location: http://www.php.net/ Actual result: -- HTTP Response: file1.php: HTTP/1.0 302 Found Location: http://www.php.net/ file2.php: HTTP/1.0 302 Found Location: http://www.php.net/ -- Edit this bug report at http://bugs.php.net/?id=47687&edit=1
#47687 [Opn]: header("Location:") changing HTTP status
ID: 47687 User updated by: make dot fire at gmail dot com Reported By: make dot fire at gmail dot com Status: Open Bug Type: HTTP related -Operating System: windows server vista +Operating System: windows vista PHP Version: 5.3CVS-2009-03-17 (snap) New Comment: when use this test code: test.php: http://www.php.net/";); exit; ?> use broswer to visit http://localhost/test.php, the status line in response is: HTTP/1.1 302 Redirect and use php-cgi.exe under commend line get: D:\project\www>php-cgi ./test.php Status: 302 Moved Temporarily Location: http://www.php.net/ Content-type: text/html; charset=utf-8 Previous Comments: [2009-03-17 14:13:28] make dot fire at gmail dot com When run php-cgi.exe in command line, the result is expected: D:\project\www>php-cgi ./test.php Status: 303 See Other Location: http://www.php.net/ Content-type: text/html; charset=utf-8 test.php: http://www.php.net/";); exit; ?> but visit same file throuth browser and webserver (use http://localhost/test.php) will get 302 status code. [2009-03-17 13:56:28] make dot fire at gmail dot com I try to use the lastest snapshots (PHP 5.3 (5.3.0beta2-dev),VC9 x86 Non Thread Safe (2009-Mar-17 13:00:00)),got the same result. some infomation from phpinfo(): System: Windows NT 6.0 build 6001 (Windows Vista Ultimate Edition Service Pack 1) i586 Build Date: Mar 17 2009 12:55:17 Compiler: MSVC9 (Visual C++ 2008) Architecture: x86 Server API: CGI/FastCGI CGI section: Directive Local Value Master Value cgi.discard_path0 0 cgi.fix_pathinfo1 1 cgi.force_redirect 0 0 cgi.nph 0 0 cgi.redirect_status_env no valueno value cgi.rfc2616_headers 0 0 fastcgi.impersonate 1 1 fastcgi.logging 1 1 webserver is IIS7, PHP run in FastCGI mode(use php-cgi.exe). I use HttpWatch to catch response header, when use code: http://www.php.net/";); exit; ?> the status line in response is: HTTP/1.1 302 Redirect and when use code: the status line in response is: HTTP/1.1 303 See Other [2009-03-17 11:03:24] j...@php.net First of all, both of your examples work fine for me and produce the expected results. You did not mention what web server you are using? And exactly what PHP version are you using? ---- [2009-03-17 10:01:55] make dot fire at gmail dot com And, the workaround in #25044 is not working, the code: header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other'); or header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other', true, 303); will result same response header: HTTP/1.0 302 Found Location: http://www.php.net/ -------------------- [2009-03-17 09:54:21] make dot fire at gmail dot com Description: This bug is identical to bug #25044. When setting the "Location" HTTP header using the header() function, PHP automatically changes the HTTP response status to "302 Found", Whether other status codes is already set or not. Reproduce code: --- file1.php: http://www.php.net/";); exit; ?> file2.php: http://www.php.net/";); exit; ?> Expected result: HTTP Response: file1.php: HTTP/1.1 201 Created Location: http://www.php.net/ file2.php: HTTP/1.1 303 See Other Location: http://www.php.net/ Actual result: -- HTTP Response: file1.php: HTTP/1.0 302 Found Location: http://www.php.net/ file2.php: HTTP/1.0 302 Found Location: http://www.php.net/ -- Edit this bug report at http://bugs.php.net/?id=47687&edit=1
#47687 [Opn]: header("Location:") changing HTTP status in FCGI mode.
ID: 47687 User updated by: make dot fire at gmail dot com -Summary: header("Location:") changing HTTP status Reported By: make dot fire at gmail dot com Status: Open Bug Type: HTTP related Operating System: windows vista PHP Version: 5.3CVS-2009-03-17 (snap) New Comment: If change to ISAPI mode(use php5isapi.dll), the result is expected. http://www.php.net/";); exit; ?> will got status line: HTTP/1.1 303 See Other Previous Comments: [2009-03-17 14:24:29] make dot fire at gmail dot com when use this test code: test.php: http://www.php.net/";); exit; ?> use broswer to visit http://localhost/test.php, the status line in response is: HTTP/1.1 302 Redirect and use php-cgi.exe under commend line get: D:\project\www>php-cgi ./test.php Status: 302 Moved Temporarily Location: http://www.php.net/ Content-type: text/html; charset=utf-8 ---- [2009-03-17 14:13:28] make dot fire at gmail dot com When run php-cgi.exe in command line, the result is expected: D:\project\www>php-cgi ./test.php Status: 303 See Other Location: http://www.php.net/ Content-type: text/html; charset=utf-8 test.php: http://www.php.net/";); exit; ?> but visit same file throuth browser and webserver (use http://localhost/test.php) will get 302 status code. -------- [2009-03-17 13:56:28] make dot fire at gmail dot com I try to use the lastest snapshots (PHP 5.3 (5.3.0beta2-dev),VC9 x86 Non Thread Safe (2009-Mar-17 13:00:00)),got the same result. some infomation from phpinfo(): System: Windows NT 6.0 build 6001 (Windows Vista Ultimate Edition Service Pack 1) i586 Build Date: Mar 17 2009 12:55:17 Compiler: MSVC9 (Visual C++ 2008) Architecture: x86 Server API: CGI/FastCGI CGI section: Directive Local Value Master Value cgi.discard_path0 0 cgi.fix_pathinfo1 1 cgi.force_redirect 0 0 cgi.nph 0 0 cgi.redirect_status_env no valueno value cgi.rfc2616_headers 0 0 fastcgi.impersonate 1 1 fastcgi.logging 1 1 webserver is IIS7, PHP run in FastCGI mode(use php-cgi.exe). I use HttpWatch to catch response header, when use code: http://www.php.net/";); exit; ?> the status line in response is: HTTP/1.1 302 Redirect and when use code: the status line in response is: HTTP/1.1 303 See Other [2009-03-17 11:03:24] j...@php.net First of all, both of your examples work fine for me and produce the expected results. You did not mention what web server you are using? And exactly what PHP version are you using? ------------ [2009-03-17 10:01:55] make dot fire at gmail dot com And, the workaround in #25044 is not working, the code: header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other'); or header("Location: http://www.php.net/";); header('HTTP/1.1 303 See Other', true, 303); will result same response header: HTTP/1.0 302 Found Location: http://www.php.net/ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/47687 -- Edit this bug report at http://bugs.php.net/?id=47687&edit=1
#47687 [Fbk->Opn]: header("Location:") changing HTTP status in FCGI mode.
ID: 47687 User updated by: make dot fire at gmail dot com Reported By: make dot fire at gmail dot com -Status: Feedback +Status: Open Bug Type: HTTP related Operating System: windows vista PHP Version: 5.3CVS-2009-03-17 (snap) New Comment: I have tried using PHP 5.2 (5.2.10-dev), both VC6 x86 Non Thread Safe (2009-Mar-18 00:00:00) and VC6 x86 Thread Safe (2009-Mar-18 00:00:00). And have tried on windows vista and windows server 2008, got the same results: test code: code1: http://www.php.net/";); exit; ?> code2: code3: http://www.php.net/";); exit; ?> the problem only occurs when run php in fastCGI mode(using php-cgi.exe). code1 produce status line: HTTP/1.1 302 Redirect (expected: HTTP/1.1 303 See Other) code2 porduct status line: HTTP/1.1 303 See Other (expected: HTTP/1.1 303 See Other) code3 product status line: HTTP/1.1 302 Redirect (expected: HTTP/1.1 302 Moved Temporarily) when run php in ISAPI mode(using php5isapi.dll) or run php-cgi.exe under commend line, both test codes will produce expected result. it seems that something wrong with header("Location: ") with CGI mode... Previous Comments: [2009-03-17 21:11:42] j...@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ---- [2009-03-17 14:30:46] make dot fire at gmail dot com If change to ISAPI mode(use php5isapi.dll), the result is expected. http://www.php.net/";); exit; ?> will got status line: HTTP/1.1 303 See Other -------- [2009-03-17 14:24:29] make dot fire at gmail dot com when use this test code: test.php: http://www.php.net/";); exit; ?> use broswer to visit http://localhost/test.php, the status line in response is: HTTP/1.1 302 Redirect and use php-cgi.exe under commend line get: D:\project\www>php-cgi ./test.php Status: 302 Moved Temporarily Location: http://www.php.net/ Content-type: text/html; charset=utf-8 ------------ [2009-03-17 14:13:28] make dot fire at gmail dot com When run php-cgi.exe in command line, the result is expected: D:\project\www>php-cgi ./test.php Status: 303 See Other Location: http://www.php.net/ Content-type: text/html; charset=utf-8 test.php: http://www.php.net/";); exit; ?> but visit same file throuth browser and webserver (use http://localhost/test.php) will get 302 status code. -------------------- [2009-03-17 13:56:28] make dot fire at gmail dot com I try to use the lastest snapshots (PHP 5.3 (5.3.0beta2-dev),VC9 x86 Non Thread Safe (2009-Mar-17 13:00:00)),got the same result. some infomation from phpinfo(): System: Windows NT 6.0 build 6001 (Windows Vista Ultimate Edition Service Pack 1) i586 Build Date: Mar 17 2009 12:55:17 Compiler: MSVC9 (Visual C++ 2008) Architecture: x86 Server API: CGI/FastCGI CGI section: Directive Local Value Master Value cgi.discard_path0 0 cgi.fix_pathinfo1 1 cgi.force_redirect 0 0 cgi.nph 0 0 cgi.redirect_status_env no valueno value cgi.rfc2616_headers 0 0 fastcgi.impersonate 1 1 fastcgi.logging 1 1 webserver is IIS7, PHP run in FastCGI mode(use php-cgi.exe). I use HttpWatch to catch response header, when use code: http://www.php.net/";); exit; ?> the status line in response is: HTTP/1.1 302 Redirect and when use code: the status line in response is: HTTP/1.1 303 See Other The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/47687 -- Edit this bug report at http://bugs.php.net/?id=47687&edit=1
#47687 [Fbk->Opn]: header("Location:") changing HTTP status in FCGI mode.
ID: 47687 User updated by: make dot fire at gmail dot com Reported By: make dot fire at gmail dot com -Status: Feedback +Status: Open Bug Type: HTTP related Operating System: windows vista PHP Version: 5.3CVS-2009-03-17 (snap) New Comment: yep, I think that you're right. wait for M$ to fix it.. Previous Comments: [2009-03-18 14:38:24] dmi...@php.net The issue is probably caused by fastcgi module of web server. The PHP sends proper headers, but it looks like fastcgi module sets status to 302 in case it finds "Location" header. [2009-03-18 02:16:40] make dot fire at gmail dot com I have tried using PHP 5.2 (5.2.10-dev), both VC6 x86 Non Thread Safe (2009-Mar-18 00:00:00) and VC6 x86 Thread Safe (2009-Mar-18 00:00:00). And have tried on windows vista and windows server 2008, got the same results: test code: code1: http://www.php.net/";); exit; ?> code2: code3: http://www.php.net/";); exit; ?> the problem only occurs when run php in fastCGI mode(using php-cgi.exe). code1 produce status line: HTTP/1.1 302 Redirect (expected: HTTP/1.1 303 See Other) code2 porduct status line: HTTP/1.1 303 See Other (expected: HTTP/1.1 303 See Other) code3 product status line: HTTP/1.1 302 Redirect (expected: HTTP/1.1 302 Moved Temporarily) when run php in ISAPI mode(using php5isapi.dll) or run php-cgi.exe under commend line, both test codes will produce expected result. it seems that something wrong with header("Location: ") with CGI mode... [2009-03-17 21:11:42] j...@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------ [2009-03-17 14:30:46] make dot fire at gmail dot com If change to ISAPI mode(use php5isapi.dll), the result is expected. http://www.php.net/";); exit; ?> will got status line: HTTP/1.1 303 See Other ---------------- [2009-03-17 14:24:29] make dot fire at gmail dot com when use this test code: test.php: http://www.php.net/";); exit; ?> use broswer to visit http://localhost/test.php, the status line in response is: HTTP/1.1 302 Redirect and use php-cgi.exe under commend line get: D:\project\www>php-cgi ./test.php Status: 302 Moved Temporarily Location: http://www.php.net/ Content-type: text/html; charset=utf-8 The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/47687 -- Edit this bug report at http://bugs.php.net/?id=47687&edit=1