#6729 closed defect (bug) (fixed)
bp_attachments_uploads_dir_get throws notices on wp_upload_dir error
Reported by: |
|
Owned by: |
|
---|---|---|---|
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)
Change History (8)
#2
@
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 :)
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()