mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- Fixed a bug that caused PHP not to properly flush its output buffer, if more
than one output buffer was used
This commit is contained in:
parent
a44361a769
commit
816f1f7903
3 changed files with 47 additions and 47 deletions
6
NEWS
6
NEWS
|
@ -3,9 +3,13 @@ PHP 4.0 NEWS
|
|||
|
||||
|
||||
?? ??? 2000, Version 4.0.4
|
||||
|
||||
- Fixed a bug that caused PHP not to properly flush its output buffer, if more
|
||||
than one output buffer was used. (Zeev)
|
||||
- Fixed a bug that could draw the shutdown sequence of the PHP Apache module
|
||||
into an endless loop, under certain circumstances. It could cause Apache
|
||||
processes under Solaris to get stuck, especially when using output buffering.
|
||||
processes under Solaris to get stuck, especially when using output
|
||||
buffering. (Zeev)
|
||||
- Add support for serializing references (Stas)
|
||||
- Fixed conflict with OpenLDAP and Oracle 8.1.x (Jani)
|
||||
- parse_ini_file() supports a new optional 2nd argument that instructs it
|
||||
|
|
|
@ -31,7 +31,6 @@ static int php_ub_body_write_no_header(const char *str, uint str_length);
|
|||
static int php_b_body_write(const char *str, uint str_length);
|
||||
|
||||
static void php_ob_init(uint initial_size, uint block_size, zval *output_handler);
|
||||
static void php_ob_destroy(void);
|
||||
static void php_ob_append(const char *text, uint text_length);
|
||||
#if 0
|
||||
static void php_ob_prepend(const char *text, uint text_length);
|
||||
|
@ -108,6 +107,7 @@ PHPAPI void php_end_ob_buffer(int send_buffer)
|
|||
char *final_buffer=NULL;
|
||||
int final_buffer_length=0;
|
||||
zval *alternate_buffer=NULL;
|
||||
char *to_be_destroyed_buffer;
|
||||
SLS_FETCH();
|
||||
OLS_FETCH();
|
||||
|
||||
|
@ -146,6 +146,7 @@ PHPAPI void php_end_ob_buffer(int send_buffer)
|
|||
final_buffer = OG(active_ob_buffer).buffer;
|
||||
final_buffer_length = OG(active_ob_buffer).text_length;
|
||||
}
|
||||
|
||||
if (OG(nesting_level)==1) { /* end buffering */
|
||||
if (SG(headers_sent) && !SG(request_info).headers_only) {
|
||||
OG(php_body_write) = php_ub_body_write_no_header;
|
||||
|
@ -153,13 +154,31 @@ PHPAPI void php_end_ob_buffer(int send_buffer)
|
|||
OG(php_body_write) = php_ub_body_write;
|
||||
}
|
||||
}
|
||||
|
||||
to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
|
||||
|
||||
if (OG(nesting_level)>1) { /* restore previous buffer */
|
||||
php_ob_buffer *ob_buffer_p;
|
||||
|
||||
zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
|
||||
OG(active_ob_buffer) = *ob_buffer_p;
|
||||
zend_stack_del_top(&OG(ob_buffers));
|
||||
if (OG(nesting_level)==2) { /* destroy the stack */
|
||||
zend_stack_destroy(&OG(ob_buffers));
|
||||
}
|
||||
}
|
||||
|
||||
if (send_buffer) {
|
||||
OG(php_body_write)(final_buffer, final_buffer_length);
|
||||
}
|
||||
|
||||
if (alternate_buffer) {
|
||||
zval_ptr_dtor(&alternate_buffer);
|
||||
}
|
||||
php_ob_destroy();
|
||||
|
||||
efree(to_be_destroyed_buffer);
|
||||
|
||||
OG(nesting_level)--;
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,27 +247,6 @@ static void php_ob_init(uint initial_size, uint block_size, zval *output_handler
|
|||
}
|
||||
|
||||
|
||||
static void php_ob_destroy()
|
||||
{
|
||||
OLS_FETCH();
|
||||
|
||||
if (OG(nesting_level)>0) {
|
||||
efree(OG(active_ob_buffer).buffer);
|
||||
if (OG(nesting_level)>1) { /* restore previous buffer */
|
||||
php_ob_buffer *ob_buffer_p;
|
||||
|
||||
zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
|
||||
OG(active_ob_buffer) = *ob_buffer_p;
|
||||
zend_stack_del_top(&OG(ob_buffers));
|
||||
if (OG(nesting_level)==2) { /* destroy the stack */
|
||||
zend_stack_destroy(&OG(ob_buffers));
|
||||
}
|
||||
}
|
||||
}
|
||||
OG(nesting_level)--;
|
||||
}
|
||||
|
||||
|
||||
static void php_ob_append(const char *text, uint text_length)
|
||||
{
|
||||
char *target;
|
||||
|
|
|
@ -31,7 +31,6 @@ static int php_ub_body_write_no_header(const char *str, uint str_length);
|
|||
static int php_b_body_write(const char *str, uint str_length);
|
||||
|
||||
static void php_ob_init(uint initial_size, uint block_size, zval *output_handler);
|
||||
static void php_ob_destroy(void);
|
||||
static void php_ob_append(const char *text, uint text_length);
|
||||
#if 0
|
||||
static void php_ob_prepend(const char *text, uint text_length);
|
||||
|
@ -108,6 +107,7 @@ PHPAPI void php_end_ob_buffer(int send_buffer)
|
|||
char *final_buffer=NULL;
|
||||
int final_buffer_length=0;
|
||||
zval *alternate_buffer=NULL;
|
||||
char *to_be_destroyed_buffer;
|
||||
SLS_FETCH();
|
||||
OLS_FETCH();
|
||||
|
||||
|
@ -146,6 +146,7 @@ PHPAPI void php_end_ob_buffer(int send_buffer)
|
|||
final_buffer = OG(active_ob_buffer).buffer;
|
||||
final_buffer_length = OG(active_ob_buffer).text_length;
|
||||
}
|
||||
|
||||
if (OG(nesting_level)==1) { /* end buffering */
|
||||
if (SG(headers_sent) && !SG(request_info).headers_only) {
|
||||
OG(php_body_write) = php_ub_body_write_no_header;
|
||||
|
@ -153,13 +154,31 @@ PHPAPI void php_end_ob_buffer(int send_buffer)
|
|||
OG(php_body_write) = php_ub_body_write;
|
||||
}
|
||||
}
|
||||
|
||||
to_be_destroyed_buffer = OG(active_ob_buffer).buffer;
|
||||
|
||||
if (OG(nesting_level)>1) { /* restore previous buffer */
|
||||
php_ob_buffer *ob_buffer_p;
|
||||
|
||||
zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
|
||||
OG(active_ob_buffer) = *ob_buffer_p;
|
||||
zend_stack_del_top(&OG(ob_buffers));
|
||||
if (OG(nesting_level)==2) { /* destroy the stack */
|
||||
zend_stack_destroy(&OG(ob_buffers));
|
||||
}
|
||||
}
|
||||
|
||||
if (send_buffer) {
|
||||
OG(php_body_write)(final_buffer, final_buffer_length);
|
||||
}
|
||||
|
||||
if (alternate_buffer) {
|
||||
zval_ptr_dtor(&alternate_buffer);
|
||||
}
|
||||
php_ob_destroy();
|
||||
|
||||
efree(to_be_destroyed_buffer);
|
||||
|
||||
OG(nesting_level)--;
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,27 +247,6 @@ static void php_ob_init(uint initial_size, uint block_size, zval *output_handler
|
|||
}
|
||||
|
||||
|
||||
static void php_ob_destroy()
|
||||
{
|
||||
OLS_FETCH();
|
||||
|
||||
if (OG(nesting_level)>0) {
|
||||
efree(OG(active_ob_buffer).buffer);
|
||||
if (OG(nesting_level)>1) { /* restore previous buffer */
|
||||
php_ob_buffer *ob_buffer_p;
|
||||
|
||||
zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
|
||||
OG(active_ob_buffer) = *ob_buffer_p;
|
||||
zend_stack_del_top(&OG(ob_buffers));
|
||||
if (OG(nesting_level)==2) { /* destroy the stack */
|
||||
zend_stack_destroy(&OG(ob_buffers));
|
||||
}
|
||||
}
|
||||
}
|
||||
OG(nesting_level)--;
|
||||
}
|
||||
|
||||
|
||||
static void php_ob_append(const char *text, uint text_length)
|
||||
{
|
||||
char *target;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue