From 86c342437ae5962b14ca18bb08b0a0130a454e93 Mon Sep 17 00:00:00 2001 From: Dhanendran Rajagopal Date: Fri, 8 Dec 2023 23:36:16 +0530 Subject: [PATCH 1/5] Check return value of get_post_meta --- includes/utils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/utils.php b/includes/utils.php index 41aa5b8df..8b84204d5 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -435,6 +435,7 @@ function excluded_meta() { function prepare_meta( $post_id ) { update_postmeta_cache( array( $post_id ) ); $meta = get_post_meta( $post_id ); + $meta = is_array( $meta ) ? $meta : array(); $prepared_meta = array(); $excluded_meta = excluded_meta(); From a382cfdcd612234476e8dc4b50937f15238010aa Mon Sep 17 00:00:00 2001 From: Kirtan Gajjar <8456197+kirtangajjar@users.noreply.github.com> Date: Thu, 4 Jul 2024 23:53:45 +0530 Subject: [PATCH 2/5] Early return if meta is false --- includes/utils.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/utils.php b/includes/utils.php index 8f604f94d..5b139308e 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -435,6 +435,11 @@ function excluded_meta() { function prepare_meta( $post_id ) { update_postmeta_cache( array( $post_id ) ); $meta = get_post_meta( $post_id ); + + if ( false === $meta ) { + return array(); + } + $meta = is_array( $meta ) ? $meta : array(); $prepared_meta = array(); $excluded_meta = excluded_meta(); From 2f6c586a223ecb69330b6ed3f592a542e362c533 Mon Sep 17 00:00:00 2001 From: Kirtan Gajjar <8456197+kirtangajjar@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:23:21 +0530 Subject: [PATCH 3/5] Update includes/utils.php Co-authored-by: Faisal Alvi --- includes/utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/utils.php b/includes/utils.php index 5b139308e..607a07985 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -434,7 +434,7 @@ function excluded_meta() { */ function prepare_meta( $post_id ) { update_postmeta_cache( array( $post_id ) ); - $meta = get_post_meta( $post_id ); + $meta = get_post_meta( $post_id ); if ( false === $meta ) { return array(); From c151a3ad79bdecc93b5f786eb1ff1b1444f805bf Mon Sep 17 00:00:00 2001 From: Kirtan Gajjar <8456197+kirtangajjar@users.noreply.github.com> Date: Fri, 5 Jul 2024 17:23:51 +0530 Subject: [PATCH 4/5] Update includes/utils.php Co-authored-by: Faisal Alvi --- includes/utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/utils.php b/includes/utils.php index 607a07985..beea76d2e 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -440,7 +440,7 @@ function prepare_meta( $post_id ) { return array(); } - $meta = is_array( $meta ) ? $meta : array(); + $meta = is_array( $meta ) ? $meta : array(); $prepared_meta = array(); $excluded_meta = excluded_meta(); From 58984799c1ac40daeed3dff5d731c951296d843e Mon Sep 17 00:00:00 2001 From: Faisal Alvi Date: Tue, 9 Jul 2024 17:25:39 +0530 Subject: [PATCH 5/5] Update includes/utils.php --- includes/utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/utils.php b/includes/utils.php index beea76d2e..607a07985 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -440,7 +440,7 @@ function prepare_meta( $post_id ) { return array(); } - $meta = is_array( $meta ) ? $meta : array(); + $meta = is_array( $meta ) ? $meta : array(); $prepared_meta = array(); $excluded_meta = excluded_meta();