summaryrefslogtreecommitdiff
path: root/main/output.c
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-09-30 23:46:43 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-09-30 23:46:43 +0000
commitecf146cbce13e3fcc11f69f59ad0a93ea147cf1a (patch)
tree9261c5192da1015bca10d6145e0e6cd396f59aeb /main/output.c
parent6477b0b5d8348820cacc5db1753740e801213c52 (diff)
downloadphp-git-ecf146cbce13e3fcc11f69f59ad0a93ea147cf1a.tar.gz
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.
Diffstat (limited to 'main/output.c')
-rw-r--r--main/output.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/main/output.c b/main/output.c
index 17a6491063..1a6993be44 100644
--- a/main/output.c
+++ b/main/output.c
@@ -388,23 +388,26 @@ static int php_ob_init_named(uint initial_size, uint block_size, char *handler_n
{
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));