From 991bb5f6d29900beea2743d9e9cced99049e117a Mon Sep 17 00:00:00 2001 From: Dusty Reagan Date: Wed, 24 Jul 2024 21:26:25 -0500 Subject: [PATCH] Fix class-wpcom-admin-bar.php fatal error (#38526) * If is object cast as array * changelog * Bail if not an array --- .../packages/jetpack-mu-wpcom/changelog/fix-admin-bar-error | 4 ++++ .../src/features/wpcom-admin-bar/class-wpcom-admin-bar.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/fix-admin-bar-error diff --git a/projects/packages/jetpack-mu-wpcom/changelog/fix-admin-bar-error b/projects/packages/jetpack-mu-wpcom/changelog/fix-admin-bar-error new file mode 100644 index 0000000000000..451decd387f51 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/fix-admin-bar-error @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Fix fatal error in admin bar diff --git a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/class-wpcom-admin-bar.php b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/class-wpcom-admin-bar.php index d6da0d3de5d2a..d4aedf14478f5 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/class-wpcom-admin-bar.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/class-wpcom-admin-bar.php @@ -60,7 +60,7 @@ class WPCOM_Admin_Bar extends \WP_Admin_Bar { * } */ public function add_node( $args ) { - if ( empty( $args['href'] ) ) { + if ( ! is_array( $args ) || empty( $args['href'] ) ) { parent::add_node( $args ); return; }