[wp-trac] [WordPress Trac] #61862: Redundant code and potential inaccurate check in script-loader.php

WordPress Trac noreply at wordpress.org
Wed Aug 14 13:05:50 UTC 2024


#61862: Redundant code and potential inaccurate check in script-loader.php
---------------------------+---------------------
 Reporter:  MattyRob       |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  6.7
Component:  Script Loader  |     Version:  5.1
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |     Focuses:
---------------------------+---------------------
Changes (by sabernhardt):

 * version:  trunk => 5.1


Old description:

> Since [44651] removed the build steps for a gzipped version of TinyMCE
> that has remained code in script-loader.php that checks if gzip is
> supported on the server, these checks are redundant and superfluous.
>
> They may also result in the uncompressed files being used when the
> compressed files are available and could be used.
>
> https://core.trac.wordpress.org/browser/trunk/src/wp-includes/script-
> loader.php#L57
>
> {{{#!php
> $compressed = $compress_scripts && $concatenate_scripts && isset(
> $_SERVER['HTTP_ACCEPT_ENCODING'] )
>                         && false !== stripos(
> $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $force_uncompressed;
>
> }}}
>  can are replaced with:
>
> {{{#!php
> $compressed = $compress_scripts && $concatenate_scripts && !
> $force_uncompressed;
> }}}
>
> The documentation further down may also need updating.

New description:

 Since [44651] removed the build steps for a gzipped version of TinyMCE
 that has remained code in `script-loader.php` that checks if gzip is
 supported on the server, these checks are redundant and superfluous.

 They may also result in the uncompressed files being used when the
 compressed files are available and could be used.

 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/script-
 loader.php?rev=58880#L57 script-loader.php, line 57]

 {{{#!php
 $compressed = $compress_scripts && $concatenate_scripts && isset(
 $_SERVER['HTTP_ACCEPT_ENCODING'] )
                         && false !== stripos(
 $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $force_uncompressed;

 }}}

 can are replaced with:

 {{{#!php
 $compressed = $compress_scripts && $concatenate_scripts && !
 $force_uncompressed;
 }}}

 The documentation further down may also need updating.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61862#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list