-
Notifications
You must be signed in to change notification settings - Fork 800
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 plugin - JSON API: Fix Warnings in post endpoints #38365
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: other | ||
|
||
Jetpack plugin - JSON API: Fix Warnings in post endpoints |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this one, would we also need to check if So There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as #38365 (comment) |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if this should be
is_object($info) ? $info->guid ?? null : null
? If guid is still a bool it would seem like this would still trigger a warning as we're trying to access a property on a bool?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it wouldn't as it's safe to check object properties and sub-properties with
isset
directly. Checkout https://onlinephp.io/c/bacc9There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah true, it doesn't actually generate a PHP warning using isset, only editor notices in test cases.