[wp-trac] [WordPress Trac] #52145: Prevent exception when no author
WordPress Trac
noreply at wordpress.org
Tue Dec 22 04:07:19 UTC 2020
#52145: Prevent exception when no author
--------------------------+-----------------------------
Reporter: shaunjeffrey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
An additional check for when $author is false should be added to `wp-
admin/includes/media.php:3291` in order to prevent an exception from being
thrown.
One example is when images are added to the media library via an import
script. If the author is not defined, then an exception will be thrown
when attempting to edit the media post, as you cannot call the method
exists on a non-object.
The easiest way to get around this issue is to simply check to ensure that
$author is not empty.
# wp-admin/includes/media.php:3291 - Change the conditional to include
a check for $author.
if ( $author && $author->exists() ) {
[https://github.com/shaunjc/WordPress/commit/d939e85767f51f4b13c4ae7c6385d57ce8ab6fa9]
[https://github.com/WordPress/WordPress/pull/507]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52145>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list