From 77c87bc51611e3ed6e4062187e43d1b9124278ff Mon Sep 17 00:00:00 2001 From: "Jorge A. Torres" Date: Wed, 1 Mar 2023 18:44:26 -0300 Subject: [PATCH 1/2] Check that $post->ID exists before using in COTMigrationUtil::get_post_or_object_meta() --- plugins/woocommerce/src/Internal/Utilities/COTMigrationUtil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/woocommerce/src/Internal/Utilities/COTMigrationUtil.php b/plugins/woocommerce/src/Internal/Utilities/COTMigrationUtil.php index 1f0d52cc547..c1be7077e7b 100644 --- a/plugins/woocommerce/src/Internal/Utilities/COTMigrationUtil.php +++ b/plugins/woocommerce/src/Internal/Utilities/COTMigrationUtil.php @@ -96,7 +96,7 @@ class COTMigrationUtil { } return $data->get_meta( $key, $single ); } else { - return get_post_meta( $post->ID, $key, $single ); + return isset( $post->ID ) ? get_post_meta( $post->ID, $key, $single ) : false; } } From 7c7611856bd1a01a9b0939c1ce0a99e2013c7638 Mon Sep 17 00:00:00 2001 From: "Jorge A. Torres" Date: Wed, 1 Mar 2023 18:44:55 -0300 Subject: [PATCH 2/2] Add changelog --- plugins/woocommerce/changelog/fix-35543 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 plugins/woocommerce/changelog/fix-35543 diff --git a/plugins/woocommerce/changelog/fix-35543 b/plugins/woocommerce/changelog/fix-35543 new file mode 100644 index 00000000000..a427c9577b6 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-35543 @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Prevent possible warning arising from use of woocommerce_wp_* family of functions.