Repository navigation
Repair wp/5.8 branch Actions: Check for a current screen before reading its ID in the global styles settings - #84459
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ecf6107 to
98d9147
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
98d9147 to
dc97fc7
Compare
dc97fc7 to
ea9852c
Compare
ea9852c to
9eface2
Compare
rejaulalomkhan
left a comment
There was a problem hiding this comment.
Thanks for working on this, @desrosj!
Verifying is_object( get_current_screen() ) before accessing ->id resolves the PHP 8.0 test failure in WP_Test_Block_Editor without altering behavior when a current screen is set. Clean backport matching #84424 and trunk's #39543. LGTM!
AI Review: Gemini 2.5 Pro (Antigravity)
9eface2 to
f13a2b4
Compare
f13a2b4 to
107c7fc
Compare
…l styles settings.
107c7fc to
f275ca0
Compare
Part of #82935.
What?
In
gutenberg_experimental_global_styles_settings()(lib/global-styles.php), checks thatget_current_screen()returns a screen before reading itsid.Why?
The function checks that
get_current_screenis callable, but not that a screen has been set, and then readsget_current_screen()->id. When the block editor settings are built without a current screen, as inWP_Test_Block_Editor, that reads a property onnull. On PHP 8 this is a warning, which PHPUnit turns into an error, so thePHP 8.0legs ofunit-test.yml(single site and multisite) fail with:These are the only errors left in those legs.
How?
Adds
is_object( get_current_screen() ) &&to the condition, as trunk did in #39543 (3f19397) andwp/5.9did in #84424. The trunk commit doesn't cherry-pick here because the code had moved tolib/compat/wordpress-6.0/block-editor-settings.phpon trunk, so the same one-line change is applied tolib/global-styles.php. Without a screen,$contextstays'all', the value it already gets on PHP 7.Use of AI Tools
This PR was created by Claude Code under my supervision. All code should be treated as AI-produced and not yet reviewed by a human until this PR is marked Ready for Review.
🤖 Generated with Claude Code