]> granicus.if.org Git - php/commitdiff
Make it possible to enable chunked output buffering without providing
authorZeev Suraski <zeev@php.net>
Sat, 11 Aug 2001 22:55:00 +0000 (22:55 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 11 Aug 2001 22:55:00 +0000 (22:55 +0000)
an output handling function

main/main.c
main/output.c
main/php_globals.h

index 620ba9bc58ea7c55ebdedfe75993d9a75b594a06..cf3e760108a515b3f60e09ef406fefb77ac783d6 100644 (file)
@@ -227,7 +227,7 @@ PHP_INI_BEGIN()
        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_BOOLEAN("output_buffering",         "0",            PHP_INI_PERDIR|PHP_INI_SYSTEM,OnUpdateBool,     output_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_ALL,            OnUpdateBool,                   register_argc_argv,             php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("register_globals",         "1",            PHP_INI_ALL,            OnUpdateBool,                   register_globals,               php_core_globals,       core_globals)
@@ -669,7 +669,11 @@ int php_request_startup(TSRMLS_D)
                        Z_TYPE_P(output_handler) = IS_STRING;
                        php_start_ob_buffer(output_handler, 0 TSRMLS_CC);
                } else if (PG(output_buffering)) {
-                       php_start_ob_buffer(NULL, 0 TSRMLS_CC);
+                       if (PG(output_buffering)>1) {
+                               php_start_ob_buffer(NULL, PG(output_buffering) TSRMLS_CC);
+                       } else {
+                               php_start_ob_buffer(NULL, 0 TSRMLS_CC);
+                       }
                } else if (PG(implicit_flush)) {
                        php_start_implicit_flush(TSRMLS_C);
                }
index 63d9b2d8f196552faf55f1e435ad8546e158b1c0..d8a10cfa6d653f36e57732dd4531128cb738948e 100644 (file)
@@ -482,12 +482,11 @@ static int php_ub_body_write(const char *str, uint str_length TSRMLS_DC)
    Turn on Output Buffering (specifying an optional output handler). */
 PHP_FUNCTION(ob_start)
 {
-       zval *output_handler;
+       zval *output_handler=NULL;
        uint chunk_size=0;
 
        switch (ZEND_NUM_ARGS()) {
                case 0:
-                       output_handler = NULL;
                        break;
                case 1: {
                                zval **output_handler_p;
@@ -506,9 +505,11 @@ PHP_FUNCTION(ob_start)
                                if (zend_get_parameters_ex(2, &output_handler_p, &chunk_size_p)==FAILURE) {
                                        RETURN_FALSE;
                                }
-                               SEPARATE_ZVAL(output_handler_p);
-                               output_handler = *output_handler_p;
-                               output_handler->refcount++;
+                               if (Z_STRLEN_PP(output_handler_p)>0) {
+                                       SEPARATE_ZVAL(output_handler_p);
+                                       output_handler = *output_handler_p;
+                                       output_handler->refcount++;
+                               }
                                convert_to_long_ex(chunk_size_p);
                                chunk_size = (uint) Z_LVAL_PP(chunk_size_p);
                        }
index 0499e8c1334a34965f8fe261099a395cc4bd188b..e1caa6eaf38ca32455514e0d6bb6478bfa749425 100644 (file)
@@ -52,12 +52,13 @@ struct _php_core_globals {
        zend_bool magic_quotes_runtime;
        zend_bool magic_quotes_sybase;
 
+       zend_bool safe_mode;
+
        zend_bool allow_call_time_pass_reference;
-       zend_bool zend_set_utility_values;
-       zend_bool output_buffering;
        zend_bool implicit_flush;
 
-       zend_bool safe_mode;
+       int output_buffering;
+
        char *safe_mode_include_dir;
        zend_bool safe_mode_gid;
        zend_bool sql_safe_mode;