Skip to content

Commit fa53b22

Browse files
authored
My Jetpack: Prevent red bubble fatals when notification data is malformed (#45385)
1 parent 28c8f21 commit fa53b22

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Prevent PHP errors when notification data is malformed.

projects/packages/my-jetpack/src/class-red-bubble-notifications.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public static function register_rest_endpoints() {
4343
'type' => 'string',
4444
),
4545
'sanitize_callback' => function ( $param ) {
46+
if ( ! is_array( $param ) ) {
47+
return array();
48+
}
4649
return array_map( 'sanitize_text_field', $param );
4750
},
4851
),

0 commit comments

Comments
 (0)