[wp-trac] [WordPress Trac] #12344: wp_set_object_terms() causes php notice when WP_DEBUG is on

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 23 02:31:01 UTC 2010


#12344: wp_set_object_terms() causes php notice when WP_DEBUG is on
------------------------------+---------------------------------------------
 Reporter:  jeremyclarke      |       Owner:  jeremyclarke
     Type:  defect (bug)      |      Status:  new         
 Priority:  normal            |   Milestone:  3.0         
Component:  Warnings/Notices  |     Version:  3.0         
 Severity:  normal            |    Keywords:              
------------------------------+---------------------------------------------
 Super simple problem. When WP_DEBUG is set to true and the $append
 argument is set to true in wp_set_object_terms() a PHP notice is output
 that can kill a post form submission.

 The culprit is a do_action call at the bottom of the function that
 presumes that $old_tt_ids has been set, even though currently $old_tt_ids
 is only set if $append == false (the default).

 {{{
 do_action('set_object_terms', $object_id, $terms, $tt_ids, $taxonomy,
 $append, $old_tt_ids);
 }}}

 My solution is simply to define $old_tt_ids as an array before the initial
 definition happens similar to how $tt_ids and $term_ids are defined as
 blank arrays at the start. I also reorganized the three definitions a bit
 so that they are all in the same place at the top of the function.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12344>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list