Skip to content

Repair wp/5.8 branch Actions: Check for a current screen before reading its ID in the global styles settings - #84459

Open
desrosj wants to merge 1 commit into
fix-actions-5.8/fix-pattern-directory-testsfrom
fix-actions-5.8/fix-block-editor-current-screen-null
Open

desrosj wants to merge 1 commit into
fix-actions-5.8/fix-pattern-directory-testsfrom
fix-actions-5.8/fix-block-editor-current-screen-null

Conversation

@desrosj

@desrosj desrosj commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Part of #82935.

What?

In gutenberg_experimental_global_styles_settings() (lib/global-styles.php), checks that get_current_screen() returns a screen before reading its id.

Why?

The function checks that get_current_screen is callable, but not that a screen has been set, and then reads get_current_screen()->id. When the block editor settings are built without a current screen, as in WP_Test_Block_Editor, that reads a property on null. On PHP 8 this is a warning, which PHPUnit turns into an error, so the PHP 8.0 legs of unit-test.yml (single site and multisite) fail with:

1) WP_Test_Block_Editor::test_get_block_editor_settings_overrides_default_settings_all_editors
Attempt to read property "id" on null
/var/www/html/wp-content/plugins/gutenberg/lib/global-styles.php:83

2) WP_Test_Block_Editor::test_get_block_editor_settings_deprecated_filter_post_editor
Attempt to read property "id" on null
/var/www/html/wp-content/plugins/gutenberg/lib/global-styles.php:83

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) and wp/5.9 did in #84424. The trunk commit doesn't cherry-pick here because the code had moved to lib/compat/wordpress-6.0/block-editor-settings.php on trunk, so the same one-line change is applied to lib/global-styles.php. Without a screen, $context stays '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

@desrosj desrosj added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 9, 2026
@desrosj desrosj self-assigned this Oct 9, 2026
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 04d35e3c-5cdf-44d0-90f0-99d5a2355fc1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@desrosj
desrosj added this pull request to stack #84460 October 9, 2026 18:29
@desrosj
desrosj removed this pull request from stack #84460 October 10, 2026 00:22
@desrosj
desrosj changed the base branch from fix-actions-5.8/fix-pattern-directory-tests to wp/5.8 October 10, 2026 00:23
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-block-editor-current-screen-null branch from ecf6107 to 98d9147 Compare October 10, 2026 00:24
@desrosj
desrosj changed the base branch from wp/5.8 to fix-actions-5.8/fix-pattern-directory-tests October 10, 2026 00:27
@desrosj
desrosj added this pull request to stack #84492 October 10, 2026 00:27
@desrosj
desrosj marked this pull request as ready for review October 13, 2026 01:12
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: rejaulalomkhan <rejaulalomkhan@git.wordpress.org>
Co-authored-by: aaronjorbin <jorbin@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@desrosj
desrosj force-pushed the fix-actions-5.8/fix-block-editor-current-screen-null branch from 98d9147 to dc97fc7 Compare October 13, 2026 02:34
@desrosj
desrosj removed this pull request from stack #84492 October 16, 2026 01:21
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-block-editor-current-screen-null branch from dc97fc7 to ea9852c Compare October 16, 2026 01:21
@desrosj
desrosj added this pull request to stack #84874 October 16, 2026 01:21
@desrosj
desrosj removed this pull request from stack #84874 October 16, 2026 15:49
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-block-editor-current-screen-null branch from ea9852c to 9eface2 Compare October 16, 2026 15:49
@desrosj
desrosj added this pull request to stack #84943 October 16, 2026 15:50

@rejaulalomkhan rejaulalomkhan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@desrosj
desrosj force-pushed the fix-actions-5.8/fix-block-editor-current-screen-null branch from 9eface2 to f13a2b4 Compare October 19, 2026 17:09

@aaronjorbin aaronjorbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code doesn't suck

@desrosj
desrosj removed this pull request from stack #84943 October 21, 2026 19:47
@desrosj
desrosj added this pull request to stack #85352 October 21, 2026 19:48
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-block-editor-current-screen-null branch from f13a2b4 to 107c7fc Compare October 22, 2026 18:35
@desrosj
desrosj force-pushed the fix-actions-5.8/fix-block-editor-current-screen-null branch from 107c7fc to f275ca0 Compare October 23, 2026 13:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants