[wp-trac] [WordPress Trac] #58878: Replace all instances of ctype_digit() with is_numeric()

WordPress Trac noreply at wordpress.org
Sun Jul 23 03:38:44 UTC 2023


#58878: Replace all instances of ctype_digit() with is_numeric()
----------------------------+------------------------------
 Reporter:  rajinsharwar    |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------------------

Comment (by ayeshrajans):

 `ctype_digit` is `/d+/` match, while `is_numeric` function is `/[\d.]/`,
 so the two functions are not identical.

 I think the correct approach is to cast the variable to a string `e.g
 ctype_digit((string) $var)`.

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


More information about the wp-trac mailing list