[wp-trac] [WordPress Trac] #39895: wp_set_object_terms tries to treat object as string
WordPress Trac
noreply at wordpress.org
Thu Feb 16 22:15:31 UTC 2017
#39895: wp_set_object_terms tries to treat object as string
--------------------------+-----------------------------
Reporter: dracos | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.7.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39895>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list