dmitry          Tue Sep  2 13:22:00 2008 UTC

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

  Modified files:              
    /php-src    NEWS 
    /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/NEWS?r1=1.2027.2.547.2.1211&r2=1.2027.2.547.2.1212&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1211 php-src/NEWS:1.2027.2.547.2.1212
--- php-src/NEWS:1.2027.2.547.2.1211    Tue Sep  2 09:45:36 2008
+++ php-src/NEWS        Tue Sep  2 13:21:59 2008
@@ -23,6 +23,8 @@
   in parsed file). (Jani)
 - Fixed bug #45862 (get_class_vars is inconsistent with 'protected' and 
   'private' variables). (ilewis at uk dot ibm dot com, Felipe)
+- Fixed bug #45860 (header() function fails to correctly replace all Status
+  lines). (Dmitry)
 - Fixed bug #45805 (Crash on throwing exception from error handler). (Dmitry)
 - Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause
   an error). (Felipe)
http://cvs.php.net/viewvc.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.60&r2=1.267.2.15.2.61&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.60 
php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.61
--- php-src/sapi/cgi/cgi_main.c:1.267.2.15.2.60 Fri Aug 15 07:30:31 2008
+++ php-src/sapi/cgi/cgi_main.c Tue Sep  2 13:22:00 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: cgi_main.c,v 1.267.2.15.2.60 2008/08/15 07:30:31 dmitry Exp $ */
+/* $Id: cgi_main.c,v 1.267.2.15.2.61 2008/09/02 13:22:00 dmitry Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -369,6 +369,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;
@@ -424,6 +425,7 @@
                }
                if (!has_status) {
                        PHPWRITE_H(buf, len);
+                       ignore_status = 1;
                }
        }
 
@@ -431,8 +433,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