Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Jetpack)(PHP8)(GB 17.1.3) Make the check around $google_fonts_data's array more resilient and return early if key or value is not of the right type #34382

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
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
@@ -0,0 +1,4 @@
Significance: patch
Type: compat

Google Fonts: resolve occasional bug resulting in PHP 8 with latest Gutenberg.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ function jetpack_get_google_fonts_data() {
}
}

return $data;
if ( is_array( $data ) && is_array( $data['fontFamilies'] ) ) {
return $data;
}
}

/**
Expand All @@ -56,15 +58,11 @@ function jetpack_get_google_fonts_data() {
* @return object[] The map of the the available Google Fonts.
*/
function jetpack_get_available_google_fonts_map( $google_fonts_data ) {
$font_families = isset( $google_fonts_data ) && isset( $google_fonts_data['fontFamilies'] )
? $google_fonts_data['fontFamilies']
: array();

$jetpack_google_fonts_list = array_map(
function ( $font_family ) {
return $font_family['name'];
},
$font_families
$google_fonts_data['fontFamilies']
);

/** This filter is documented in modules/google-fonts/wordpress-6.3/load-google-fonts.php */
Expand Down
Loading