Make WordPress Core

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#61862 closed defect (bug) (fixed)

Redundant code and potential inaccurate check in script-loader.php

Reported by: mattyrob's profile MattyRob Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.7 Priority: normal
Severity: normal Version: 5.1
Component: Script Loader Keywords: has-patch
Focuses: Cc:

Description (last modified by sabernhardt)

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.

script-loader.php, line 57

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

can are replaced with:

$compressed = $compress_scripts && $concatenate_scripts && ! $force_uncompressed;

The documentation further down may also need updating.

Change History (9)

This ticket was mentioned in PR #7191 on WordPress/wordpress-develop by @hbhalodia.


5 months ago
#1

  • Keywords has-patch added

#2 @hbhalodia
5 months ago

Hi @MattyRob, Have raised the PR for the same.

Thank You,

#3 @SergeyBiryukov
5 months ago

  • Milestone changed from Awaiting Review to 6.7

#4 @MattyRob
5 months ago

@hbhalodia - patch looks good but inline documentation further down still references wp-tinymce.js.gz so that many also need adjusting.

#5 @sabernhardt
5 months ago

  • Description modified (diff)
  • Version changed from trunk to 5.1

#6 @hbhalodia
5 months ago

Hi @MattyRob @SergeyBiryukov, I have updated the inline documentation to not reference the gz. Can you please take a look if that is needs to be updated?

Thank You,

#7 @MattyRob
5 months ago

That looks good to me but would need a core committer to approve and merge it.

#8 @SergeyBiryukov
5 months ago

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

In 58902:

Script Loader: Remove redundant check in wp_register_tinymce_scripts().

Since removing the build steps for a gzipped version of TinyMCE, the check whether gzip is supported on the server is superfluous. It may also result in the uncompressed files being used when the compressed files are available and could be used.

Follow-up to [44114], [44651].

Props MattyRob, hbhalodia.
Fixes #61862.

@SergeyBiryukov commented on PR #7191:


5 months ago
#9

Thanks for the PR! Merged in r58902.

Note: See TracTickets for help on using tickets.