From d2ed1a3f50c0baa312a8b58514eac539b5ce7504 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 6 Oct 2025 07:17:33 -0600 Subject: [PATCH 1/2] Prevent fatals when handling unexpected data --- .../packages/my-jetpack/src/class-red-bubble-notifications.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/packages/my-jetpack/src/class-red-bubble-notifications.php b/projects/packages/my-jetpack/src/class-red-bubble-notifications.php index 93f3d8b516b38..2a330268c9a3d 100644 --- a/projects/packages/my-jetpack/src/class-red-bubble-notifications.php +++ b/projects/packages/my-jetpack/src/class-red-bubble-notifications.php @@ -43,6 +43,9 @@ public static function register_rest_endpoints() { 'type' => 'string', ), 'sanitize_callback' => function ( $param ) { + if ( ! is_array( $param ) ) { + return array(); + } return array_map( 'sanitize_text_field', $param ); }, ), From 15127cbf82b1652c0de6b118376bb67895d2aa02 Mon Sep 17 00:00:00 2001 From: tbradsha <32492176+tbradsha@users.noreply.github.com> Date: Mon, 6 Oct 2025 07:18:23 -0600 Subject: [PATCH 2/2] Add changelog --- .../my-jetpack/changelog/fix-my-jetpack-red_bubble_fatals | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/packages/my-jetpack/changelog/fix-my-jetpack-red_bubble_fatals diff --git a/projects/packages/my-jetpack/changelog/fix-my-jetpack-red_bubble_fatals b/projects/packages/my-jetpack/changelog/fix-my-jetpack-red_bubble_fatals new file mode 100644 index 0000000000000..1d042bc99acb9 --- /dev/null +++ b/projects/packages/my-jetpack/changelog/fix-my-jetpack-red_bubble_fatals @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Prevent PHP errors when notification data is malformed.