summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r--ext/zlib/zlib.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index fb2e6ce55e..d5f2b924ad 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -905,6 +905,24 @@ PHP_FUNCTION(ob_gzhandler)
ZEND_WRONG_PARAM_COUNT();
}
+ /* check for wrong usages */
+ if (OG(ob_nesting_level>1)) {
+ if (php_ob_handler_used("ob_gzhandler" TSRMLS_CC)) {
+ php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used twice");
+ RETURN_FALSE;
+ }
+ if (php_ob_handler_used("mb_output_handler" TSRMLS_CC)) {
+ php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used after 'mb_output_handler'");
+ RETURN_FALSE;
+ }
+ if (php_ob_handler_used("URL-Rewriter" TSRMLS_CC)) {
+ php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "output handler 'ob_gzhandler' cannot be used after 'URL-Rewriter'");
+ RETURN_FALSE;
+ }
+ if (php_ob_init_conflict("ob_gzhandler", "zlib output compression" TSRMLS_CC))
+ RETURN_FALSE;
+ }
+
if (ZLIBG(ob_gzhandler_status)==-1
|| zend_hash_find(&EG(symbol_table), "HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS"), (void **) &data)==FAILURE
|| Z_TYPE_PP(data)!=IS_ARRAY