dmitry          Tue Sep  2 13:22:16 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/sapi/cgi/tests     010.phpt 

  Modified files:              
    /php-src/sapi/cgi   cgi_main.c 
  Log:
  Fixed bug #45860 (header() function fails to correctly replace all Status 
lines)
  
  
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.50.2.27&r2=1.267.2.15.2.50.2.28&diff_format=u
Index: php-src/sapi/cgi/cgi_main.c
diff -u php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.27 
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.28
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.50.2.27    Tue Aug 26 15:37:01 2008
+++ php-src/sapi/cgi/cgi_main.c Tue Sep  2 13:22:15 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.27 2008/08/26 15:37:01 rasmus Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.50.2.28 2008/09/02 13:22:15 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -375,6 +375,7 @@
        char buf[SAPI_CGI_MAX_HEADER_LENGTH];
        sapi_header_struct *h;
        zend_llist_position pos;
+       zend_bool ignore_status = 0;
 
        if (SG(request_info).no_headers == 1) {
                return  SAPI_HEADER_SENT_SUCCESSFULLY;
@@ -430,6 +431,7 @@
                }
                if (!has_status) {
                        PHPWRITE_H(buf, len);
+                       ignore_status = 1;
                }
        }
 
@@ -437,8 +439,17 @@
        while (h) {
                /* prevent CRLFCRLF */
                if (h->header_len) {
-                       PHPWRITE_H(h->header, h->header_len);
-                       PHPWRITE_H("\r\n", 2);
+                       if (h->header_len > sizeof("Status:")-1 &&
+                           strncasecmp(h->header, "Status:", 
sizeof("Status:")-1) == 0) {
+                           if (!ignore_status) {
+                                   ignore_status = 1;
+                                       PHPWRITE_H(h->header, h->header_len);
+                                       PHPWRITE_H("\r\n", 2);
+                               }
+                       } else {
+                               PHPWRITE_H(h->header, h->header_len);
+                               PHPWRITE_H("\r\n", 2);
+                       }
                }
                h = 
(sapi_header_struct*)zend_llist_get_next_ex(&sapi_headers->headers, &pos);
        }

http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/tests/010.phpt?view=markup&rev=1.1
Index: php-src/sapi/cgi/tests/010.phpt
+++ php-src/sapi/cgi/tests/010.phpt



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to