tony2001                Mon Jun 25 21:12:47 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/standard       basic_functions.c 
  Log:
  fix #41773 (php_strip_whitespace sends headers with errors suppressed)
  MFB is not needed, output buffering in HEAD handles this situation correctly
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.798&r2=1.2027.2.547.2.799&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.798 php-src/NEWS:1.2027.2.547.2.799
--- php-src/NEWS:1.2027.2.547.2.798     Mon Jun 25 18:26:52 2007
+++ php-src/NEWS        Mon Jun 25 21:12:47 2007
@@ -36,7 +36,9 @@
 - Fixed PECL bug #11216 (crash in ZipArchive::addEmptyDir when a directory 
   already exists). (Pierre)
 
-- Fixed bug #41765 (Recode crashes/does not work on amd64) 
+- Fixed bug #41773 (php_strip_whitespace() sends headers with errors 
+  suppressed). (Tony)
+- Fixed bug #41765 (Recode crashes/does not work on amd64). 
   (nexus at smoula dot net, Stas)
 - Fixed bug #41724 (libxml_get_last_error() - errors service request scope).
   (thekid at php dot net, Ilia)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.54&r2=1.725.2.31.2.55&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.54 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.55
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.54      Sat Jun  9 
11:44:08 2007
+++ php-src/ext/standard/basic_functions.c      Mon Jun 25 21:12:47 2007
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.54 2007/06/09 11:44:08 sniper Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.55 2007/06/25 21:12:47 tony2001 Exp $ 
*/
 
 #include "php.h"
 #include "php_streams.h"
@@ -5455,7 +5455,18 @@
 
        if (highlight_file(filename, &syntax_highlighter_ini TSRMLS_CC) == 
FAILURE) {
                if (i) { 
-                       php_end_ob_buffer (1, 0 TSRMLS_CC); 
+                       int res = php_ob_get_buffer(return_value TSRMLS_CC);
+
+                       /* flush the buffer only if there is something to flush 
*/
+                       if (res == SUCCESS && Z_STRLEN_P(return_value) > 0) {
+                               php_end_ob_buffer (1, 0 TSRMLS_CC);
+                               zval_dtor(return_value);
+                       } else {
+                               php_end_ob_buffer (0, 0 TSRMLS_CC);
+                               if (res == SUCCESS) {
+                                       zval_dtor(return_value);
+                               }
+                       }
                }
                RETURN_FALSE;
        }
@@ -5482,8 +5493,6 @@
                RETURN_FALSE;
        }
 
-       php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
-
        file_handle.type = ZEND_HANDLE_FILENAME;
        file_handle.filename = filename;
        file_handle.free_filename = 0;
@@ -5491,10 +5500,11 @@
        zend_save_lexical_state(&original_lex_state TSRMLS_CC);
        if (open_file_for_scanning(&file_handle TSRMLS_CC)==FAILURE) {
                zend_restore_lexical_state(&original_lex_state TSRMLS_CC);
-               php_end_ob_buffer(1, 0 TSRMLS_CC);
                RETURN_EMPTY_STRING();
        }
 
+       php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC);
+
        zend_strip(TSRMLS_C);
        
        zend_destroy_file_handle(&file_handle TSRMLS_CC);

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

Reply via email to