diff options
author | Zeev Suraski <zeev@php.net> | 2001-07-02 18:17:10 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2001-07-02 18:17:10 +0000 |
commit | 551f1831a7dc0ef96082a6f95f565553be590798 (patch) | |
tree | 24793ff58625dbd68364233fd5d9d687b4adcb18 /ext/standard | |
parent | 610ebfe3de1c0a1acd63bb7e20bed9a997760413 (diff) | |
download | php-git-551f1831a7dc0ef96082a6f95f565553be590798.tar.gz |
Fix a major thread safety bug in the output mechanism
@- Fixed a major memory corruption bug in the thread safe version (Zeev)
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/output.c | 18 | ||||
-rw-r--r-- | ext/standard/php_output.h | 1 |
2 files changed, 11 insertions, 8 deletions
diff --git a/ext/standard/output.c b/ext/standard/output.c index cacf045a0c..c29ef41900 100644 --- a/ext/standard/output.c +++ b/ext/standard/output.c @@ -61,22 +61,24 @@ static void php_output_init_globals(OLS_D) /* Start output layer */ -PHPAPI void php_output_startup() +PHPAPI void php_output_startup(void) { #ifdef ZTS output_globals_id = ts_allocate_id(sizeof(php_output_globals), (ts_allocate_ctor) php_output_init_globals, NULL); #else php_output_init_globals(OLS_C); #endif +} - { - OLS_FETCH(); - OG(php_body_write) = php_ub_body_write; - OG(php_header_write) = sapi_module.ub_write; - OG(nesting_level) = 0; - OG(lock) = 0; - } +PHPAPI void php_output_activate(void) +{ + OLS_FETCH(); + + OG(php_body_write) = php_ub_body_write; + OG(php_header_write) = sapi_module.ub_write; + OG(nesting_level) = 0; + OG(lock) = 0; } diff --git a/ext/standard/php_output.h b/ext/standard/php_output.h index 58a3db8c15..2d06f5ce34 100644 --- a/ext/standard/php_output.h +++ b/ext/standard/php_output.h @@ -26,6 +26,7 @@ typedef void (*php_output_handler_func_t)(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode); PHPAPI void php_output_startup(void); +PHPAPI void php_output_activate(void); void php_output_register_constants(void); PHPAPI int php_body_write(const char *str, uint str_length); PHPAPI int php_header_write(const char *str, uint str_length); |