WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#11169 closed defect (bug) (fixed)

Problem with $_SERVER['HTTP_ACCEPT_ENCODING'] in wp-tinymce.php

Reported by: cutesquirrel Owned by: westi
Milestone: 2.9 Priority: low
Severity: trivial Version: 2.9
Component: Warnings/Notices Keywords: has-patch
Focuses: Cc:

Description

Hello,

my environnement :
Wordpress 2.8.6
PHP 5.3

my tinyMCE editor doesn't work because a notice is generated when testing $_SERVERHTTP_ACCEPT_ENCODING? value.
This index HTTP_ACCEPT_ENCODING is not defined on my server (umbreon network).
It's very easy to solve this problem :

Replace
###############################
if ( isset($_GETc?) && 1 == $_GETc? &&

false !== strpos(strtolower($_SERVERHTTP_ACCEPT_ENCODING?), 'gzip')

&& ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {

header('Content-Encoding: gzip');
echo $file;

} else {

echo get_file($basepath . '/wp-tinymce.js');

}
###############################

BY

###############################
if ( isset($_GETc?) && 1 == $_GETc? &&

isset($_SERVERHTTP_ACCEPT_ENCODING?)&&
false !== strpos(strtolower($_SERVERHTTP_ACCEPT_ENCODING?), 'gzip')

&& ( $file = get_file($basepath . '/wp-tinymce.js.gz') ) ) {

header('Content-Encoding: gzip');
echo $file;

} else {

echo get_file($basepath . '/wp-tinymce.js');

}
###############################

I didn't find why notice are triggered while error_reporting is normaly without E_NOTICE. But maybe a plugin add an error_reporting level.

(Sorry for my english, I hope it's understandable !)

Best regards.
Etienne

Attachments (2)

11169_HTTP_ACCEPT_ENCODING.patch (1.4 KB) - added by nacin 5 years ago.
11169_HTTP_ACCEPT_ENCODING_load-styles-scripts.patch (3.8 KB) - added by nacin 5 years ago.
Second patch includes fix for load-styles.php and load-scripts.php

Download all attachments as: .zip

Change History (10)

comment:1 @nacin5 years ago

  • Component changed from Editor to Warnings/Notices
  • Keywords has-patch added; tinyMCE HTTP_ACCEPT_ENCODING removed
  • Owner set to westi
  • Severity changed from critical to normal
  • Version changed from 2.8 to 2.9

Patch attached to hide notices if server doesn't send accepted encoding.

@nacin5 years ago

Second patch includes fix for load-styles.php and load-scripts.php

comment:2 follow-up: @nacin5 years ago

Second patch includes fix for load-styles.php and load-scripts.php. This is particularly trivial, as error_reporting would need to be turned on manually in the corresponding file.

comment:3 follow-up: @azaozz5 years ago

  • Keywords reporter-feedback added

What server and browser are you using? The check for HTTP_ACCEPT_ENCODING is there for legacy reasons. This header is sent by the browser and I haven't heard of any current browsers that support JS but don't support gzip.

comment:4 in reply to: ↑ 3 @cutesquirrel5 years ago

Replying to azaozz:

What server and browser are you using? The check for HTTP_ACCEPT_ENCODING is there for legacy reasons. This header is sent by the browser and I haven't heard of any current browsers that support JS but don't support gzip.

I'm using Firefox 3.5, or IE8, the HTTP header Accept-encoding is present, but I think it's the HTTP server who doesn't bring the HTTP_ACCEPT_ENCODING in the $_SERVER. I don't know why... Maybe because my host is "umbreon network", a free hosting solution. But they have PHP 5.3, Apache 2.2, ...

comment:5 in reply to: ↑ 2 @cutesquirrel5 years ago

Replying to nacin:

Second patch includes fix for load-styles.php and load-scripts.php. This is particularly trivial, as error_reporting would need to be turned on manually in the corresponding file.

Thanks acin, to have been so fast !
Bye

comment:6 @nacin5 years ago

  • Severity changed from normal to trivial

Since it's so rare for the server not to set this, if we don't wontfix it then we could just silence it with @$_SERVER['HTTP_ACCEPT_ENCODING'] and save the isset check.

comment:7 @dd325 years ago

  • Keywords reporter-feedback removed
  • Milestone set to 2.9

if we don't wontfix it then we could just silence it with @$_SERVERHTTP_ACCEPT_ENCODING? and save the isset check.

It'd be cleaner to stick to using the isset() check simply to keep it in line with he rest of WordPress. However, Error reporting on files such as that one (where its only purpose is to output a file as fast as possible) could probably do with having the error reporing level set to off..

comment:8 @azaozz5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [12214].

Note: See TracTickets for help on using tickets.