[buddypress-trac] [BuddyPress] #3958: Errors returned from wp_crop_image during avatar upload are not handled, resulting in silent failure

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Thu Jan 26 12:14:48 UTC 2012


#3958: Errors returned from wp_crop_image during avatar upload are not handled,
resulting in silent failure
--------------------------+-----------------------------
 Reporter:  drhodesmumby  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:  1.5.3
 Severity:  major         |   Keywords:
--------------------------+-----------------------------
 Well, it's in the title.

 If wp_crop_image fails for whatever reason (in my case because I didn't
 have the gd image library installed) then Buddypress silently ignores it
 and declares the upload and cropping process of an avatar to be successful
 nonetheless.

 The issue is in bp-core/bp-core-avatars.php on lines 548-554, which
 attempt to use wp_crop_image without handling any errors returned:

 {{{
 // Crop the image
 $full_cropped  = wp_crop_image( $original_file, (int)$crop_x,
 (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_full_width(),
 bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' .
 $full_filename );
 $thumb_cropped = wp_crop_image( $original_file, (int)$crop_x,
 (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_thumb_width(),
 bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' .
 $thumb_filename );

 // Remove the original
 @unlink( $original_file );

 return true;
 }}}

 Ideally Buddypress would handle the error returned by wp_crop_image and
 report it to the user.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3958>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list