]> granicus.if.org Git - php/commitdiff
Fixed bug #39984 (redirect response code in header() could be ignored in
authorIlia Alshanetsky <iliaa@php.net>
Sun, 31 Dec 2006 19:22:01 +0000 (19:22 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 31 Dec 2006 19:22:01 +0000 (19:22 +0000)
CGI sapi).

NEWS
main/SAPI.c

diff --git a/NEWS b/NEWS
index b334edefc5a5418a416562ef9bc0fefbf14fc10f..7730388eb5e1bec4dd4e08850f0e49ddfb927ca9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ PHP                                                                        NEWS
   __inet_pton() and inet_ntop() was named __inet_ntop(). (Hannes)
 - Fixed the validate email filter so that the letter "v" can also be used in
   the user part of the email address. (Derick)
+- Fixed bug #39984 (redirect response code in header() could be ignored in
+  CGI sapi). (Ilia)
 - Fixed bug #39971 (pg_insert/pg_update do not allow now() to be used for
   timestamp fields). (Ilia)
 - Fixed bug #39952 (zip ignoring --with-libdir on zlib checks) (judas dot
index 8abca79ed20798323f0f62d3e3754574a30ee7dd..4c14712a19d61efadc51c4687d0c0f5eab657643 100644 (file)
@@ -631,7 +631,9 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC)
                                        SG(sapi_headers).http_response_code > 307) &&
                                        SG(sapi_headers).http_response_code != 201) {
                                        /* Return a Found Redirect if one is not already specified */
-                                       if(SG(request_info).proto_num > 1000 && 
+                                       if (http_response_code) { /* user specified redirect code */
+                                               sapi_update_response_code(http_response_code TSRMLS_CC);
+                                       } else if (SG(request_info).proto_num > 1000 && 
                                           SG(request_info).request_method && 
                                           strcmp(SG(request_info).request_method, "HEAD") &&
                                           strcmp(SG(request_info).request_method, "GET")) {