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. 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 ); }, ),