cvs: php4 /main output.c

From: Date: Mon, 30 Sep 2002 23:46:43 +0000
Subject: cvs: php4 /main output.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-14369@lists.php.net to get a copy of this message
yohgaki Mon Sep 30 19:46:43 2002 EDT Modified files: /php4/main output.c Log: Users can shoot themselves by their own output handler always. Therefore, this check is overkill and it should be documented limitation, IMO. Anyway, a little optimization. Index: php4/main/output.c diff -u php4/main/output.c:1.122 php4/main/output.c:1.123 --- php4/main/output.c:1.122 Mon Sep 30 06:18:06 2002 +++ php4/main/output.c Mon Sep 30 19:46:43 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.122 2002/09/30 10:18:06 wez Exp $ */ +/* $Id: output.c,v 1.123 2002/09/30 23:46:43 yohgaki Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -388,23 +388,26 @@ { int handler_gz, handler_mb, handler_ic; - /* check for specific handlers where rules apply */ - handler_gz = strcmp(handler_name, "ob_gzhandler"); - handler_mb = strcmp(handler_name, "mb_output_handler"); - handler_ic = strcmp(handler_name, "ob_iconv_handler"); - /* apply rules */ - if (!handler_gz || !handler_mb || !handler_ic) { - if (php_ob_handler_used(handler_name TSRMLS_CC)) { - php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' cannot be used twice", handler_name); - return FAILURE; + if (OG(ob_nesting_level>1)) { + /* check for specific handlers where rules apply */ + handler_gz = strcmp(handler_name, "ob_gzhandler"); + handler_mb = strcmp(handler_name, "mb_output_handler"); + handler_ic = strcmp(handler_name, "ob_iconv_handler"); + /* apply rules */ + if (!handler_gz || !handler_mb || !handler_ic) { + if (php_ob_handler_used(handler_name TSRMLS_CC)) { + php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler '%s' cannot be used twice", 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)) + return FAILURE; + if (!handler_ic && php_ob_init_conflict(handler_name, "mb_output_handler" TSRMLS_CC)) + 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)) - return FAILURE; - if (!handler_ic && php_ob_init_conflict(handler_name, "mb_output_handler" TSRMLS_CC)) - return FAILURE; } + if (OG(ob_nesting_level)>0) { if (OG(ob_nesting_level)==1) { /* initialize stack */ zend_stack_init(&OG(ob_buffers));

« previous php.cvs (#14369) next »