[wp-trac] [WordPress Trac] #18009: term_exists uses is_int so '0' does not equal 0 and so wp_set_object_terms will create 0

WordPress Trac wp-trac at lists.automattic.com
Wed Jul 6 18:26:43 UTC 2011


#18009: term_exists uses is_int so '0' does not equal 0 and so wp_set_object_terms
will create 0
--------------------------+-----------------------------
 Reporter:  agalindo      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 If setting object terms and one has not type casted string 0 to integer 0
 then term_exists will see this as a category name and return false, the
 category 0 does not exists and wp_set_object_terms will create it.

 It exists on line 1452 of taxonomy.php
 (http://core.trac.wordpress.org/browser/tags/3.2/wp-
 includes/taxonomy.php#L1452)

 The fix is simple, switching is_int to is_numeric

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


More information about the wp-trac mailing list