Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,18 @@ public function sanitize( $setting, $fields ) {
}
} else {
if ( is_array( $field ) ) {
array_walk_recursive( $field, 'sanitize_text_field' );
array_walk_recursive(
$field,
static function( $field_value ) {
// WP 4.9 compatibility, as _sanitize_text_fields() didn't have this check yet, and this prevents an error.
// @see https://github.com/WordPress/wordpress-develop/blob/b30baca3ca2feb7f44b3615262ca55fcd87ae232/src/wp-includes/formatting.php#L5307
if ( is_object( $field_value ) || is_array( $field_value ) ) {
return '';
}

return sanitize_text_field( $field_value );
}
);
} else {
$setting[ $slug ] = sanitize_text_field( $field );
}
Expand Down