From 39d30e23461ebc331bf09edc8b5be67d9d15641e Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Thu, 21 Jul 2022 02:15:50 +0200 Subject: [PATCH] ensure variable is of type string --- inc/block-editor.php | 3 +++ inc/custom-comments.php | 6 +++++- inc/jetpack.php | 12 ++++++++---- inc/woocommerce.php | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/inc/block-editor.php b/inc/block-editor.php index 889b6f31..a0c9ea38 100644 --- a/inc/block-editor.php +++ b/inc/block-editor.php @@ -44,6 +44,9 @@ if ( ! function_exists( 'understrap_generate_color_palette' ) ) { $color_palette_json = json_decode( $color_palette_json, true ); if ( is_array( $color_palette_json ) ) { foreach ( $color_palette_json as $key => $value ) { + if ( ! is_string( $key ) ) { + continue; + } $key = str_replace( array( '--bs-', '--' ), '', $key ); $color_palette[] = array( 'name' => $key, diff --git a/inc/custom-comments.php b/inc/custom-comments.php index cfe1822a..4a520c50 100644 --- a/inc/custom-comments.php +++ b/inc/custom-comments.php @@ -97,7 +97,11 @@ if ( ! function_exists( 'understrap_comment_form_comments_closed' ) ) { * Displays a note that comments are closed if comments are closed and there are comments. */ function understrap_comment_form_comments_closed() { - if ( get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) { + $post_type = get_post_type(); + if ( false === $post_type ) { + return; + } + if ( get_comments_number() && post_type_supports( $post_type, 'comments' ) ) { ?>
'; echo '