Skip to:
Content

BuddyPress.org

Opened 6 years ago

Last modified 6 years ago

#7943 new defect (bug)

Cannot use object of type WP_Error as array bp_core_avatar_handle_upload line 923

Reported by: kunleodusan's profile kunleodusan Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version:
Component: Media Keywords:
Cc:

Description

Once in a while, this error is thrown when a user uploads an avatar image.

Here's the suggested reason for error (Note comments):

Code highlighting:


$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. 

Change History (2)

#1 @DJPaul
6 years ago

  • Component changed from Core to Media
  • Milestone changed from Awaiting Review to Under Consideration

#2 @DJPaul
6 years ago

  • Milestone changed from Under Consideration to Awaiting Contributions
Note: See TracTickets for help on using tickets.