mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
fixed bug #61820
using ob_gzhandler will complain about headers already sent when no compression the Vary header should only be sent on the PHP_OUTPUT_HANDLER_START event
This commit is contained in:
parent
f21376d668
commit
df00b64cb9
2 changed files with 26 additions and 1 deletions
23
ext/zlib/tests/bug61820.phpt
Normal file
23
ext/zlib/tests/bug61820.phpt
Normal file
|
@ -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
|
|
@ -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=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();'
|
-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);
|
sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC);
|
||||||
}
|
}
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue