cvs: php4 / NEWS php.ini-dist php.ini-recommended /main main.c output.c php_globals.h php_output.h

From: Date: Sun, 01 Sep 2002 11:33:19 +0000
Subject: cvs: php4 / NEWS php.ini-dist php.ini-recommended /main main.c output.c php_globals.h php_output.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13774@lists.php.net to get a copy of this message
sebastian Sun Sep 1 07:33:19 2002 EDT Modified files: /php4 NEWS php.ini-dist php.ini-recommended /php4/main main.c output.c php_globals.h php_output.h Log: Per discussion on #php.bugs (+1 from at least Derick and Jani), revert double_buffering.

Index: php4/NEWS diff -u php4/NEWS:1.1107 php4/NEWS:1.1108 --- php4/NEWS:1.1107 Sat Aug 31 10:04:29 2002 +++ php4/NEWS Sun Sep 1 07:33:18 2002 @@ -31,8 +31,6 @@ . Implemented object signal callback ability by using array($obj, $method) . Added a restart parameter to pcntl_signal, which allows you to disable the default of system call restarting -- Added php.ini option "double_buffering" which forces an additional first - output buffer and improved handling of buffer sizes. (Marcus) - Changed DomNode->next_sibling() and DomNode->previous_sibling() to return NULL instead of false (W3C specs). (chregu) - Changed DomNode->insert_before() and DomNode->append_child() to conform to Index: php4/php.ini-dist diff -u php4/php.ini-dist:1.150 php4/php.ini-dist:1.151 --- php4/php.ini-dist:1.150 Fri Aug 23 20:56:00 2002 +++ php4/php.ini-dist Sun Sep 1 07:33:18 2002 @@ -100,14 +100,6 @@ ; and you cannot use both "ob_gzhandler" and "zlib.output_compression". ;output_handler = -; Normally you won't use an additional first output buffer when using any -; special output handler but you can enforce this since it can help to reduce -; memory used by output buffering when huge output chunks and total server -; throughput are preferred. This value can either be set 'On' in which case the -; additional buffer is four times the size of all other output buffers or any -; greater size. -;double_buffering = Off - ; Transparent output compression using the zlib library ; Valid values for this option are 'off', 'on', or a specific buffer size ; to be used for compression (default is 4KB) Index: php4/php.ini-recommended diff -u php4/php.ini-recommended:1.102 php4/php.ini-recommended:1.103 --- php4/php.ini-recommended:1.102 Fri Aug 23 20:56:00 2002 +++ php4/php.ini-recommended Sun Sep 1 07:33:18 2002 @@ -113,14 +113,6 @@ ; and you cannot use both "ob_gzhandler" and "zlib.output_compression". ;output_handler = -; Normally you won't use an additional first output buffer when using any -; special output handler but you can enforce this since it can help to reduce -; memory used by output buffering when huge output chunks and total server -; throughput are preferred. This value can either be set 'On' in which case the -; additional buffer is four times the size of all other output buffers or any -; greater size. -;double_buffering = Off - ; Transparent output compression using the zlib library ; Valid values for this option are 'off', 'on', or a specific buffer size ; to be used for compression (default is 4KB) Index: php4/main/main.c diff -u php4/main/main.c:1.483 php4/main/main.c:1.484 --- php4/main/main.c:1.483 Fri Aug 23 13:39:20 2002 +++ php4/main/main.c Sun Sep 1 07:33:19 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.483 2002/08/23 17:39:20 wez Exp $ */ +/* $Id: main.c,v 1.484 2002/09/01 11:33:19 sebastian Exp $ */ /* {{{ includes */ @@ -197,24 +197,6 @@ } /* }}} */ -/* {{{ OnUpdateOutputBuffering - */ -static PHP_INI_MH(OnUpdateOutputBuffering) -{ - if(!strncasecmp(new_value, "off", sizeof("off"))) { - new_value = "0"; - new_value_length = sizeof("0"); - } else if(!strncasecmp(new_value, "on", sizeof("on"))) { - new_value = "1"; - new_value_length = sizeof("1"); - } - OnUpdateInt(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); - - return SUCCESS; -} -/* }}} */ - - /* Need to convert to strings and make use of: * PHP_SAFE_MODE * @@ -267,8 +249,7 @@ STD_PHP_INI_BOOLEAN("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateBool, magic_quotes_gpc, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_runtime, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateBool, magic_quotes_sybase, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateOutputBuffering, output_buffering, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("double_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateOutputBuffering, double_buffering, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("output_buffering", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateInt, output_buffering, php_core_globals, core_globals) STD_PHP_INI_ENTRY("output_handler", NULL, PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateString, output_handler, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("register_argc_argv", "1", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, register_argc_argv, php_core_globals, core_globals) STD_PHP_INI_BOOLEAN("register_globals", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool, register_globals, php_core_globals, core_globals) @@ -846,7 +827,12 @@ php_start_ob_buffer_named(PG(output_handler), 0, 1 TSRMLS_CC); } else if (PG(output_buffering)) { - php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); + if (PG(output_buffering)>1) { + php_start_ob_buffer(NULL, PG(output_buffering), 0 TSRMLS_CC); + } + else { + php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); + } } else if (PG(implicit_flush)) { php_start_implicit_flush(TSRMLS_C); Index: php4/main/output.c diff -u php4/main/output.c:1.119 php4/main/output.c:1.120 --- php4/main/output.c:1.119 Sun Aug 25 10:20:37 2002 +++ php4/main/output.c Sun Sep 1 07:33:19 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.119 2002/08/25 14:20:37 helly Exp $ */ +/* $Id: output.c,v 1.120 2002/09/01 11:33:19 sebastian Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -113,61 +113,23 @@ } } -/* {{{ php_ob_default_buffer_size - * Start output buffering */ -PHPAPI int php_ob_default_buffer_size(TSRMLS_D) -{ - uint buffer_size = (uint)(PG(output_buffering) > 1 ? PG(output_buffering) : 4096); - if (OG(ob_nesting_level)==0 && PG(double_buffering)!=0) { - buffer_size = (uint)(PG(double_buffering)) >= buffer_size ? (uint)(PG(double_buffering)) : 4*buffer_size; - } - return buffer_size; -} -/* }}} */ - /* {{{ php_start_ob_buffer * Start output buffering */ PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC) { - uint initial_chunk_size, initial_size, block_size; + uint initial_size, block_size; if (OG(ob_lock)) { php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use output buffering in output buffering display handlers"); return FAILURE; } - if (OG(ob_nesting_level)==0 && PG(double_buffering)) { - initial_chunk_size = php_ob_default_buffer_size(TSRMLS_C); - initial_size = 4*initial_chunk_size; - block_size = initial_chunk_size; - php_ob_init(initial_size, block_size, NULL, initial_chunk_size, erase TSRMLS_CC); - } - if (chunk_size<2) { - chunk_size = php_ob_default_buffer_size(TSRMLS_C); - } - block_size = chunk_size; - initial_size = block_size; - return php_ob_init(initial_size, block_size, output_handler, chunk_size, erase TSRMLS_CC); -} -/* }}} */ - -/* {{{ php_start_ob_buffer_nc - * Start output buffering */ -PHPAPI int php_start_ob_buffer_ibc(zval *output_handler, uint initial_size, uint block_size, uint chunk_size, zend_bool erase TSRMLS_DC) -{ - if (OG(ob_lock)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use output buffering in output buffering display handlers"); - return FAILURE; - } - if (chunk_size==0) { + if (chunk_size) { + initial_size = (chunk_size*3/2); + block_size = chunk_size/2; + } else { + initial_size = 40*1024; block_size = 10*1024; - initial_size = 4*block_size; - } else if (chunk_size==1) { - chunk_size = php_ob_default_buffer_size(TSRMLS_C); - } - if (!block_size) - block_size = chunk_size; - if (!initial_size) - initial_size = block_size; + } return php_ob_init(initial_size, block_size, output_handler, chunk_size, erase TSRMLS_CC); } /* }}} */ @@ -366,9 +328,6 @@ */ PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC) { - if (buffer_size<2) { - buffer_size = php_ob_default_buffer_size(TSRMLS_C); - } if (OG(ob_nesting_level)==0 || OG(active_ob_buffer).internal_output_handler || strcmp(OG(active_ob_buffer).handler_name, OB_DEFAULT_HANDLER_NAME)) { php_start_ob_buffer(NULL, buffer_size, erase TSRMLS_CC); } @@ -376,7 +335,6 @@ OG(active_ob_buffer).internal_output_handler = internal_output_handler; OG(active_ob_buffer).internal_output_handler_buffer = (char *) emalloc(buffer_size); OG(active_ob_buffer).internal_output_handler_buffer_size = buffer_size; - OG(active_ob_buffer).chunk_size = buffer_size; if (OG(active_ob_buffer).handler_name) efree(OG(active_ob_buffer).handler_name); OG(active_ob_buffer).handler_name = estrdup(handler_name); @@ -432,10 +390,6 @@ php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' cannot be used twice", handler_name); return FAILURE; } - if (!handler_gz && SG(headers_sent)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' cannot be activated - headers already sent", handler_name); - return FAILURE; - } if (!handler_gz && php_ob_init_conflict(handler_name, "zlib output compression" TSRMLS_CC)) return FAILURE; if (!handler_mb && php_ob_init_conflict(handler_name, "ob_iconv_handler" TSRMLS_CC)) @@ -763,7 +717,7 @@ &chunk_size, &erase) == FAILURE) RETURN_FALSE; - if (php_start_ob_buffer_ibc(output_handler, 0, 0, chunk_size, erase TSRMLS_CC)==FAILURE) { + if (php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC)==FAILURE) { RETURN_FALSE; } RETURN_TRUE; @@ -904,8 +858,8 @@ else { add_assoc_long(elem, "type", PHP_OUTPUT_HANDLER_USER); add_assoc_long(elem, "initial_size", ob_buffer->size); + add_assoc_long(elem, "chunk_size", ob_buffer->chunk_size); } - add_assoc_long(elem, "chunk_size", ob_buffer->chunk_size); add_assoc_long(elem, "status", ob_buffer->status); add_assoc_string(elem, "name", ob_buffer->handler_name, 1); add_assoc_bool(elem, "del", ob_buffer->erase); Index: php4/main/php_globals.h diff -u php4/main/php_globals.h:1.81 php4/main/php_globals.h:1.82 --- php4/main/php_globals.h:1.81 Thu Aug 22 03:48:22 2002 +++ php4/main/php_globals.h Sun Sep 1 07:33:19 2002 @@ -58,7 +58,6 @@ zend_bool implicit_flush; int output_buffering; - int double_buffering; char *safe_mode_include_dir; zend_bool safe_mode_gid; Index: php4/main/php_output.h diff -u php4/main/php_output.h:1.42 php4/main/php_output.h:1.43 --- php4/main/php_output.h:1.42 Tue Aug 20 23:04:17 2002 +++ php4/main/php_output.h Sun Sep 1 07:33:19 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_output.h,v 1.42 2002/08/21 03:04:17 helly Exp $ */ +/* $Id: php_output.h,v 1.43 2002/09/01 11:33:19 sebastian Exp $ */ #ifndef PHP_OUTPUT_H #define PHP_OUTPUT_H @@ -31,7 +31,6 @@ PHPAPI int php_header_write(const char *str, uint str_length TSRMLS_DC); PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size, zend_bool erase TSRMLS_DC); PHPAPI int php_start_ob_buffer_named(const char *output_handler_name, uint chunk_size, zend_bool erase TSRMLS_DC); -PHPAPI int php_start_ob_buffer_ibc(zval *output_handler, uint initial_size, uint block_size, uint chunk_size, zend_bool erase TSRMLS_DC); PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS_DC); PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC); PHPAPI int php_ob_get_buffer(zval *p TSRMLS_DC); @@ -42,7 +41,6 @@ PHPAPI int php_get_output_start_lineno(TSRMLS_D); PHPAPI void php_ob_set_internal_handler(php_output_handler_func_t internal_output_handler, uint buffer_size, char *handler_name, zend_bool erase TSRMLS_DC); PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC); -PHPAPI int php_ob_default_buffer_size(TSRMLS_D); PHP_FUNCTION(ob_start); PHP_FUNCTION(ob_flush);
« previous php.cvs (#13774) next »