Skip to:
Content

#7097 closed enhancement (fixed)

Invalid array data inside bp_attachments_uploads_dir_get()

Reported by: tw2113 Owned by: tw2113
Milestone: 2.7 Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-docs good-first-bug
Cc:

Description

In the bp_attachments_uploads_dir_get function, we attempt to iterate over $upload_data. However, that variable is only created via return value from bp_upload_dir() which only returns a string. Because of this, there will never be a valid value to do a foreach over.

Attachments (1)

7097-incorrect-return-type.diff (373 bytes) - added by tw2113 18 months ago.

Download all attachments as: .zip

Change History (6)

#1 @imath
20 months ago

  • Keywords needs-docs added

I think it's a docblock issue. bp_upload_dir() returns an associative array having these keys:

  • 'path' - base directory and sub directory or full path to upload directory.
  • 'url' - base url and sub directory or absolute URL to upload directory.
  • 'subdir' - sub directory if uploads use year/month folders option is on.
  • 'basedir' - path without subdir.
  • 'baseurl' - URL path without subdir.
  • 'error' - false or error message.

That's because bp_upload_dir() is simply the result of wp_upload_dir() for the root blog id

#2 @DJPaul
19 months ago

  • Component changed from Core to Media
  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement

#3 @tw2113
18 months ago

  • Owner set to tw2113
  • Status changed from new to assigned

Looking over things, I believe @imath is likely correct overall. bp_upload_dir() is going to be either bool or array, and we return early in bp_attachments_uploads_dir_get() if false.

Going to make it a return type fix ticket instead.

#4 @tw2113
16 months ago

  • Milestone changed from Future Release to 2.7

Adding to 2.7. It's a docs fix.

#5 @tw2113
16 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 11088:

Fixes phpdoc for bp_upload_dir return type. Fixes #7097.

Note: See TracTickets for help on using tickets.