Skip to:
Content

BuddyPress.org

Opened 6 weeks ago

Closed 2 weeks ago

#9292 closed defect (bug) (fixed)

Harden the bp_get_object_terms function

Reported by: shawfactor's profile shawfactor Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 15.0.0 Priority: normal
Severity: normal Version:
Component: Core Keywords: dev-feedback close
Cc:

Description

An odd one I know but the function

bp_get_object_terms does this:

$site_terms = wp_get_object_terms( $object_ids, $site_taxonomies, $args );
$retval = array_merge( $retval, $site_terms );

except wp_get_object_terms may not actually an array, it can return a error etc

I know this is unsual but I have used bp_get_default_taxonomies to remove a taxaonomy hence egenerating an error

I think it would be a prudent to harden the above function

Change History (3)

#1 @johnjamesjacoby
6 weeks ago

  • Milestone changed from Awaiting Review to 15.0.0
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#2 @rollybueno
3 weeks ago

  • Keywords dev-feedback close added

On the Github version, the bp_get_object_terms() should already "harden" as per https://github.com/buddypress/buddypress/commit/95cd39a637001357adcfa83770594ae0d4e98870

It already handles the WP_Error or anything that is not an array(), however, this has not been shipped yet. I checked the same function from https://wordpress.org/plugins/buddypress/ version and can confirm that:

From the SVN Version 14.3.4
https://i.imgur.com/P790t5r.png

Github master
https://i.imgur.com/g4ezVxA.png

I'm not gonna close this since it's not been shipped yet, so I'll leave that to @johnjamesjacoby to decide..

#3 @johnjamesjacoby
2 weeks ago

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

Duplicate of #9227.

Note: See TracTickets for help on using tickets.