summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
authorMichael Wallner <mike@php.net>2012-04-24 19:52:45 +0200
committerMichael Wallner <mike@php.net>2012-04-24 19:52:45 +0200
commit342b641a93355e9debea263b66accd5726d8ae04 (patch)
treeef0f0bb0f53c56532c74bf35ee4443c3e3570e11 /ext/zlib
parent117207121cd8e98549fb260a9e1ba142f31c7d42 (diff)
parentdf00b64cb93dafbe5ae47bf733e826b54b32ae37 (diff)
downloadphp-git-342b641a93355e9debea263b66accd5726d8ae04.tar.gz
Merge branch 'PHP-5.4'
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/tests/bug61820.phpt23
-rw-r--r--ext/zlib/zlib.c4
2 files changed, 26 insertions, 1 deletions
diff --git a/ext/zlib/tests/bug61820.phpt b/ext/zlib/tests/bug61820.phpt
new file mode 100644
index 0000000000..6f33b54553
--- /dev/null
+++ b/ext/zlib/tests/bug61820.phpt
@@ -0,0 +1,23 @@
+--TEST--
+bug #61820 using ob_gzhandler will complain about headers already sent when no compression
+--SKIPIF--
+<?php
+extension_loaded("zlib") or die("skip");
+?>
+--FILE--
+<?php
+ob_start('ob_gzhandler');
+
+echo "Hi there.\n";
+ob_flush();
+flush();
+
+echo "This is confusing...\n";
+ob_flush();
+flush();
+?>
+DONE
+--EXPECT--
+Hi there.
+This is confusing...
+DONE
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 9973254f0a..a5f80b10b5 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -187,7 +187,9 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o
-Vary: $ HTTP_ACCEPT_ENCODING=gzip ./sapi/cgi/php <<<'<?php ob_start("ob_gzhandler"); echo "foo\n"; ob_end_clean();'
-Vary: $ HTTP_ACCEPT_ENCODING= ./sapi/cgi/php <<<'<?php ob_start("ob_gzhandler"); echo "foo\n"; ob_end_clean();'
*/
- if (output_context->op != (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_CLEAN|PHP_OUTPUT_HANDLER_FINAL)) {
+ if ((output_context->op & PHP_OUTPUT_HANDLER_START)
+ && (output_context->op != (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_CLEAN|PHP_OUTPUT_HANDLER_FINAL))
+ ) {
sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC);
}
return FAILURE;