[buddypress-trac] [BuddyPress Trac] #7943: Cannot use object of type WP_Error as array bp_core_avatar_handle_upload line 923
buddypress-trac
noreply at wordpress.org
Tue Aug 7 10:26:32 UTC 2018
#7943: Cannot use object of type WP_Error as array bp_core_avatar_handle_upload
line 923
--------------------------+-----------------------------
Reporter: kunleodusan | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Core | Version:
Severity: normal | Keywords:
--------------------------+-----------------------------
Once in a while, this error is thrown when a user uploads an avatar image.
Here's the suggested reason for error (Note comments):
{{{
#!div style="font-size: 80%"
Code highlighting:
{{{#!php
$bp->avatar_admin->resized = $avatar_attachment->shrink(
$bp->avatar_admin->original['file'], $ui_available_width ); //@return
false|string|WP_Image_Editor|WP_Error
$bp->avatar_admin->image = new stdClass();
// We only want to handle one image after resize.
if ( empty( $bp->avatar_admin->resized ) ) {
$bp->avatar_admin->image->file =
$bp->avatar_admin->original['file'];
$bp->avatar_admin->image->dir = str_replace( $upload_path, '',
$bp->avatar_admin->original['file'] );
} else {
$bp->avatar_admin->image->file =
$bp->avatar_admin->resized['path']; //Error cause if WP_Error is thrown.
}}}
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7943>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list