From 7181da9d33140a9ff169a73f67a6b97573a82aa5 Mon Sep 17 00:00:00 2001 From: Foteini Giannaropoulou Date: Wed, 17 Jul 2024 18:12:31 +0300 Subject: [PATCH] Jetpack plugin - JSON API: Fix Warnings in post endpoints (#38365) * Jetpack plugin - JSON API: Fix Warnings in post endpoints --- .../jetpack/changelog/fix-warnings-json-api-post-base | 4 ++++ projects/plugins/jetpack/sal/class.json-api-post-base.php | 8 +++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/fix-warnings-json-api-post-base diff --git a/projects/plugins/jetpack/changelog/fix-warnings-json-api-post-base b/projects/plugins/jetpack/changelog/fix-warnings-json-api-post-base new file mode 100644 index 0000000000000..3709939821770 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-warnings-json-api-post-base @@ -0,0 +1,4 @@ +Significance: patch +Type: other + + Jetpack plugin - JSON API: Fix Warnings in post endpoints diff --git a/projects/plugins/jetpack/sal/class.json-api-post-base.php b/projects/plugins/jetpack/sal/class.json-api-post-base.php index 63f1a894b24a6..418ee3b40e6a3 100644 --- a/projects/plugins/jetpack/sal/class.json-api-post-base.php +++ b/projects/plugins/jetpack/sal/class.json-api-post-base.php @@ -791,7 +791,7 @@ public function get_author() { // phpcs:disable WordPress.NamingConventions.ValidVariableName if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { $active_blog = get_active_blog_for_user( $user->ID ); - $site_id = $active_blog->blog_id; + $site_id = $active_blog->blog_id ?? -1; $profile_URL = "https://gravatar.com/{$user->user_login}"; } else { $profile_URL = 'https://gravatar.com/' . md5( strtolower( trim( $user->user_email ) ) ); @@ -1017,11 +1017,9 @@ private function get_media_item_v1_1( $media_id ) { } } - $response['videopress_guid'] = $info->guid; + $response['videopress_guid'] = $info->guid ?? null; $response['videopress_processing_done'] = true; - if ( '0000-00-00 00:00:00' === $info->finish_date_gmt ) { - $response['videopress_processing_done'] = false; - } + $response['videopress_processing_done'] = isset( $info->finish_date_gmt ) && '0000-00-00 00:00:00' !== $info->finish_date_gmt ? $info->finish_date_gmt : false; } }