Skip to content

Commit 8066de0

Browse files
committed
Check if $_SERVER['HTTP_ACCEPT_ENCODING'] is set before determining whether to compress scripts, props nacin, fixes WordPress#11169
git-svn-id: https://develop.svn.wordpress.org/trunk@12214 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7c3f9cf commit 8066de0

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

wp-admin/admin-ajax.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
echo $test_str;
9292
die;
9393
} elseif ( 2 == $_GET['test'] ) {
94+
if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
95+
die('-1');
9496
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
9597
header('Content-Encoding: deflate');
9698
$out = gzdeflate( $test_str, 1 );

wp-admin/load-scripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function get_file($path) {
127127
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
128128
header("Cache-Control: public, max-age=$expires_offset");
129129

130-
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
130+
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
131131
header('Vary: Accept-Encoding'); // Handle proxies
132132
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
133133
header('Content-Encoding: deflate');

wp-admin/load-styles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function get_file($path) {
137137
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
138138
header("Cache-Control: public, max-age=$expires_offset");
139139

140-
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') ) {
140+
if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
141141
header('Vary: Accept-Encoding'); // Handle proxies
142142
if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
143143
header('Content-Encoding: deflate');

wp-includes/js/tinymce/wp-tinymce.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?php
2+
/**
3+
* Disable error reporting
4+
*
5+
* Set this to error_reporting( E_ALL ) or error_reporting( E_ALL | E_STRICT ) for debugging
6+
*/
7+
error_reporting(0);
28

39
$basepath = dirname(__FILE__);
410

@@ -20,7 +26,9 @@ function get_file($path) {
2026
header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
2127
header("Cache-Control: public, max-age=$expires_offset");
2228

23-
if ( isset($_GET['c']) && 1 == $_GET['c'] && false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
29+
if ( isset($_GET['c']) && 1 == $_GET['c'] && isset($_SERVER['HTTP_ACCEPT_ENCODING'])
30+
&& false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {
31+
2432
header('Content-Encoding: gzip');
2533
echo $file;
2634
} else {

0 commit comments

Comments
 (0)