Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#6729 closed defect (bug) (fixed)

bp_attachments_uploads_dir_get throws notices on wp_upload_dir error

Reported by: sbrajesh's profile sbrajesh Owned by: imath's profile imath
Milestone: 2.4.2 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch commit
Cc: sbrajesh

Description

Where there is an error generated by wp_upload_dir() this causes bp_upload_dir() to return empty/false which in turn is being used by bp_attachments_uploads_dir_get().

This function does not check for empty value and assumes an array is returned, So it throws notice ": Invalid argument supplied for foreach() in bp-core-attachments.php on line 46

A check for empty will be nice to have. In my case the error was unable to create directory( which is very common case and BP should be able to notify it instead of throwing notice on all profile pages).

PS: The Profile/Cover upload pages are notifying correct error on image upload, but the notice is thrown by all pages.

Attachments (1)

6729.patch (2.0 KB) - added by imath 9 years ago.

Download all attachments as: .zip

Change History (8)

#1 @imath
9 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 2.4.1

Good catch @sbrajesh

I think for 2.4.1 we should focus on avoiding the notice (see attached patch), and improve user's feedback in 2.5 by using the error argument returned by wp_upload_dir()

@imath
9 years ago

#2 @sbrajesh
9 years ago

Thank you for the patch @imath
Tested with BuddyPress 2.4.0 and it works great.
You plan for adding feedback sounds great.

Thank you for the quick response and all your great work :)

#3 @imath
9 years ago

yw, thanks a lot for your feedback :)

#4 @DJPaul
8 years ago

  • Keywords commit added

Looks good

#5 @imath
8 years ago

In 10371:

Prevent notice errors in bp_attachments_uploads_dir_get() that are happening when wp_upload_dir() returns an error.

See #6729 (branch 2.4)

#6 @imath
8 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 10372:

Prevent notice errors in bp_attachments_uploads_dir_get() that are happening when wp_upload_dir() returns an error.

Fixes #6729 (trunk)

#7 @DJPaul
8 years ago

  • Component changed from Component - Attachments to Media
Note: See TracTickets for help on using tickets.