fix #41773 (php_strip_whitespace sends headers with errors suppressed)

MFB is not needed, output buffering in HEAD handles this situation correctly
This commit is contained in:
Antony Dovgal 2007-06-25 21:12:47 +00:00
parent fa8a77a466
commit 5daef5cd4a
2 changed files with 17 additions and 5 deletions

4
NEWS
View File

@ -36,7 +36,9 @@ PHP NEWS
- 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)

View File

@ -5455,7 +5455,18 @@ PHP_FUNCTION(highlight_file)
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 @@ PHP_FUNCTION(php_strip_whitespace)
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 @@ PHP_FUNCTION(php_strip_whitespace)
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);