[wp-trac] [WordPress Trac] #16550: wp_set_post_categories is defected

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 13 11:47:44 UTC 2011


#16550: wp_set_post_categories is defected
--------------------------+-----------------------------
 Reporter:  ptahdunbar    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 {{{wp_set_post_categories();}}} can only be passed an array of cat ids. If
 you pass it an integer, it resets the value to the default category even
 though the category exists.

 This happens as the if statement runs an OR check to see if the second
 parameter is not an array or empty. If one is true, it just goes on ahead
 and resets the parameter to be the default category regardless if the
 value was empty or a string.

 Patch fixes this by strict typing the second parameter to an array. It
 also strict types the default category id as it was being returned as a
 string.

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


More information about the wp-trac mailing list