summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/zlib/tests/bug51269.phpt21
-rw-r--r--ext/zlib/zlib.c2
3 files changed, 23 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index aa09ad3d00..a52518aed5 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ PHP NEWS
- Added stream filter support to mcrypt extension (ported from
mcrypt_filter). (Stas)
+- Fixed bug #51269 (zlib.output_compression Overwrites Vary Header). (Adam)
- Fixed bug #51257 (CURL_VERSION_LARGEFILE incorrectly used after libcurl
version 7.10.1). (aron dot ujvari at microsec dot hu)
- Fixed bug #51242 (Empty mysql.default_port does not default to 3306 anymore,
diff --git a/ext/zlib/tests/bug51269.phpt b/ext/zlib/tests/bug51269.phpt
new file mode 100644
index 0000000000..6b97bacf08
--- /dev/null
+++ b/ext/zlib/tests/bug51269.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #51269 (zlib.output_compression Overwrites Vary Header)
+--INI--
+zlib.output_compression=1
+--ENV--
+HTTP_ACCEPT_ENCODING=gzip
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) die("skip zlib required");
+?>
+--FILE--
+<?php
+header('Vary: Cookie');
+echo 'foo';
+?>
+--EXPECTF--
+%s
+--EXPECTHEADERS--
+Vary: Cookie
+Content-Encoding: gzip
+Vary: Accept-Encoding
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index d6735445b1..69c05bbb24 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1056,7 +1056,7 @@ static void php_gzip_output_handler(char *output, uint output_len, char **handle
sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC);
break;
}
- sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC);
+ sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC);
} else {
/* Disable compression if headers can not be set (Fix for bug #49816) */
ZLIBG(output_compression) = 0;