Repository navigation
Script Loader: Remove compression constants and related code - #8409
SainathPoojary wants to merge 16 commits into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
26f3114 to
46fcd92
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
28be79f to
276ed6a
Compare
|
This looks good. I hope I'll have time this weekend to go over it in more details. One thing to note is that the global Would it also be possible to remove checking these constants from |
Conflicts are resolved by taking trunk's version and reapplying the removal of the compression code and the `c` argument. Trunk has since moved to `wp_print_script_tag()`, made concatenation opt-in through `wp_should_concatenate_admin_scripts()`, and dropped the `type` attributes from the expected markup in the tests. The removal of the `COMPRESS_SCRIPTS` and `COMPRESS_CSS` rows from the debug data merges cleanly, since trunk already removed them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without an `@global` tag, PHPStan treats `$wp_version` as `mixed`, which it rejects when interpolated into the expected loader URLs (`encapsedStringPart.nonString`). The tags are added in the form other tests in these files already use, ahead of a change to those URLs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two tests added on trunk since this branch was started expect the `c` argument in the load-scripts.php and load-styles.php URLs, which are no longer printed with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scripts and styles have not been compressed from PHP since 5.0.0, so a default of true claimed compression that never happens. The globals are kept for backward compatibility with code that reads them, and a value set by a plugin is still left alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`SCRIPT_DEBUG` disables only concatenation now, and the result of the compression test no longer affects how scripts and styles are loaded, so the header no longer describes the test or its `can_compress_scripts` option. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing reads `$compress_scripts` anymore, so the cases that differed only in its value were redundant, and the test class no longer needs to back up and restore it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The globals default to false, and the `COMPRESS_SCRIPTS` and `COMPRESS_CSS` constants no longer turn them on, even where the stored result of the compression test used to. A value already set by a plugin is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs standard aligns the types and variable names within a group of tags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The endpoints already ignore compression parameters, and regression tests cover the updated settings behavior.
No open issues 🎉
What changed in this PR
Removes obsolete compression controls from the script loader while preserving compatibility globals.
Changes:
- Removes compression parameters from concatenated asset URLs.
- Defaults compression globals to false without overwriting existing values.
- Updates URL expectations and adds settings regression tests.
| File | Description |
|---|---|
| tests/phpunit/tests/dependencies/styles.php | Updates the expected stylesheet URL and global annotations. |
| tests/phpunit/tests/dependencies/scripts.php | Updates script URLs and removes obsolete compression test setup. |
| tests/phpunit/tests/dependencies/scriptConcatSettings.php | Tests compression defaults, ignored constants, and preserved globals. |
| src/wp-includes/script-loader.php | Removes legacy compression handling and updates documentation. |
Review effort: Balanced
The removal was merged to the 4.9 branch and first released in 4.9.9, ahead of 5.0.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scripts and styles have not been compressed from PHP since WordPress 4.9.9, when `load-scripts.php` and `load-styles.php` stopped reading the `c` argument in r43580. Even so, the `COMPRESS_SCRIPTS`, `COMPRESS_CSS` and `ENFORCE_GZIP` constants were still documented and read, only to set that unused argument on the loader URLs. That code and documentation are removed. The `$compress_scripts` and `$compress_css` globals are kept for backward compatibility with code that reads them, but they now default to false since nothing is compressed, and a value already set by a plugin is still left alone. The compression test, which still runs in the admin, is to be removed separately. Developed in #8409. Follow-up to r10442, r43580, r64320, r64321. Props sainathpoojary, westonruter, zodiac1978, dpknauss, azaozz. See #44815, #57548, #58302, #65980. Fixes #63017. git-svn-id: https://develop.svn.wordpress.org/trunk@64485 602fd350-edb4-49c9-b593-d223f7449a82
Scripts and styles have not been compressed from PHP since WordPress 4.9.9, when `load-scripts.php` and `load-styles.php` stopped reading the `c` argument in r43580. Even so, the `COMPRESS_SCRIPTS`, `COMPRESS_CSS` and `ENFORCE_GZIP` constants were still documented and read, only to set that unused argument on the loader URLs. That code and documentation are removed. The `$compress_scripts` and `$compress_css` globals are kept for backward compatibility with code that reads them, but they now default to false since nothing is compressed, and a value already set by a plugin is still left alone. The compression test, which still runs in the admin, is to be removed separately. Developed in WordPress/wordpress-develop#8409. Follow-up to r10442, r43580, r64320, r64321. Props sainathpoojary, westonruter, zodiac1978, dpknauss, azaozz. See #44815, #57548, #58302, #65980. Fixes #63017. Built from https://develop.svn.wordpress.org/trunk@64485 git-svn-id: http://core.svn.wordpress.org/trunk@63635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Remove legacy compression constants (COMPRESS_SCRIPTS, COMPRESS_CSS, ENFORCE_GZIP) and related code.
Before:

After:

Trac ticket: #63017
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.