diff --git a/.changeset/green-cows-accept.md b/.changeset/green-cows-accept.md new file mode 100644 index 00000000..d758c4a9 --- /dev/null +++ b/.changeset/green-cows-accept.md @@ -0,0 +1,5 @@ +--- +"@wpengine/wp-graphql-content-blocks": patch +--- + +Fix: prevent fatal errors when get_current_screen() is unset. diff --git a/includes/updates/update-callbacks.php b/includes/updates/update-callbacks.php index 4a1cf0a8..92cfc4ac 100644 --- a/includes/updates/update-callbacks.php +++ b/includes/updates/update-callbacks.php @@ -87,7 +87,7 @@ function custom_plugin_api_request( $api, $action, $args ) { */ function delegate_plugin_row_notice() { $screen = get_current_screen(); - if ( 'plugins' !== $screen->id ) { + if ( ! isset( $screen->id ) || 'plugins' !== $screen->id ) { return; } @@ -139,7 +139,7 @@ function display_plugin_row_notice() { */ function display_update_page_notice() { $screen = get_current_screen(); - if ( 'update-core' !== $screen->id ) { + if ( ! isset( $screen->id ) || 'update-core' !== $screen->id ) { return; } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index aa199cea..f9d81e69 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -10,11 +10,6 @@ parameters: count: 1 path: includes/updates/update-callbacks.php - - - message: "#^Cannot access property \\$id on WP_Screen\\|null\\.$#" - count: 2 - path: includes/updates/update-callbacks.php - - message: "#^Function WPGraphQL\\\\ContentBlocks\\\\PluginUpdater\\\\custom_plugin_api_request\\(\\) has invalid return type WPGraphQL\\\\ContentBlocks\\\\PluginUpdater\\\\stdClass\\.$#" count: 1