[wp-trac] [WordPress Trac] #16101: Numeric term fields are strings

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 4 23:25:00 UTC 2011


#16101: Numeric term fields are strings
--------------------------+-----------------------------
 Reporter:  foofy         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 The numeric fields (term_id, parent, etc.) on term objects are strings. I
 only noticed this because term_exists() uses is_int() to determine if the
 $term value is an ID or slug.

 Only ticket I could find about this is #5381.

 sanitize_term() should fix this, but it bails early in the "raw" context.
 sanitize_term_field() sanitizes the numeric fields in every context. I
 don't see a reason for sanitize_term() to bail early so I made a patch
 that takes that out. The patch also adds some missing fields to the list
 of those to be sanitized and changes term_exists() to use is_numeric()
 (which will correctly identify strings containing only numbers) instead of
 is_int().

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


More information about the wp-trac mailing list