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

WordPress Trac noreply at wordpress.org
Tue Nov 10 02:33:43 UTC 2020


#16101: Numeric term fields are strings
----------------------------------------+---------------------
 Reporter:  foofy                       |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:
Component:  Taxonomy                    |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  needs-unit-tests has-patch  |     Focuses:
----------------------------------------+---------------------
Changes (by Howdy_McGee):

 * keywords:  needs-patch needs-unit-tests => needs-unit-tests has-patch


Comment:

 It seems to me that every instance of `is_int()` in taxonomy.php is
 testing against passed input. I agree with Michael that we could use
 `ctype_digit()` for all these instances. I suppose the only drawback is
 that term slugs specifically cannot be integers which seems like a fair
 trade for more flexible user input.

 Timothy pointed out in slack that `ctype_digit()` is already used in
 [https://github.com/WordPress/WordPress/search?q=ctype_digit a few places
 already] so the previous mention of host support may be moot.

 The latest patch converts 6 instances of `is_int()` to `ctype_digit()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/16101#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list