Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#39895 closed defect (bug) (invalid)

wp_set_object_terms tries to treat object as string

Reported by: dracos Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: Taxonomy Keywords:
Focuses: Cc:


If I've understood this correctly, in wp_set_object_terms, $old_tt_ids is set to a call to wp_get_object_terms(), which returns an array of objects. It then runs array_diff on this with $tt_ids, putting the difference in $delete_tt_ids, and if there is anything different, it calls implode( "', '", $delete_tt_ids ) – which dies because it tries to treat the objects inside of $delete_tt_ids as strings, with the error:

"Object of class stdClass could not be converted to string in .../wp-includes/taxonomy.php"

When I am seeing the error, in a third party plugin, $tt_ids is empty, $old_tt_ids is an array of one stdClass Object ( [term_id] => 8, [name] => posttag, [slug] => posttag, [term_group] => 0, [term_taxonomy_id] => 8, [taxonomy] => post_tag, [description] => , [parent] => 0, [count] => 10 ) and so the error occurs.

Apologies if I've misunderstood something.

Change History (2)

#1 @dracos
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Looks like it must be another plugin interfering with get_terms, sorry for the noise.

#2 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.