You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: ensure get_current_screen is available - #3786
No actionable comments were generated in the recent review.
Walkthrough
register_block_editor_assets_admin() now checks that get_current_screen() exists and returns a non-null screen before checking whether the screen is a block editor.
This small change prevents a PHP fatal error when the block editor assets hook runs without the current-screen API available, such as in the frontend Topic editor. It has no apparent downside and is low-risk to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "fix: ensure get_current_screen is available" matches the changeset. The change in src/init.php guards the call to get_current_screen() so it returns early when the function is unavailable, …
Linked Issues check
Issue #3784 requires that the frontend Topic editor load without a PHP fatal error caused by an unguarded call to get_current_screen(). At the reviewed head, Stackable_Init::register_block_editor_asse…
Out of Scope Changes check
The change set, as described in the PR summary, touches only src/init.php, in register_block_editor_assets_admin(). The added guards (function_exists check and null check on the screen object) directl…
Full details: Title check
Explanation
The title "fix: ensure get_current_screen is available" matches the changeset. The change in src/init.php guards the call to get_current_screen() so it returns early when the function is unavailable, and only calls is_block_editor() when the screen is non-null. This addresses the fatal error described in linked issue #3784 when the Topic editor loads.
Full details: Linked Issues check
Explanation
Issue #3784 requires that the frontend Topic editor load without a PHP fatal error caused by an unguarded call to get_current_screen(). At the reviewed head, Stackable_Init::register_block_editor_assets_admin() in src/init.php returns early when function_exists( 'get_current_screen' ) is false. It calls get_current_screen() only after that check. It then calls is_block_editor() only when $current_screen is non-null. This removes the reported fatal path. The PR summary states the change is limited to this function (+6/-1). The whole-PR diff could not be read because changed blobs are missing from the checkout, so the base version was not compared line by line. The head file content was read directly and confirms the guard. No automated test is present in the evidence. The issue does not request a test, so this does not block a PASS.
Full details: Out of Scope Changes check
Explanation
The change set, as described in the PR summary, touches only src/init.php, in register_block_editor_assets_admin(). The added guards (function_exists check and null check on the screen object) directly implement the requirement in #3784. No unrelated behavior change was identified in the evidence. The direct diff could not be read, so the exact base-to-head hunk is confirmed only through the summary and the head file content. This limits certainty but does not indicate an unrelated change.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 85436ab1-eac0-48bc-8802-bdee50761c43
Commits
Reviewing files that changed from the base of the PR and between 3aba261 and 22d1364.
Files selected for processing: 1
src/init.php
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #3784
Summary by CodeRabbit