[wp-trac] [WordPress Trac] #30875: enforce integers in add_filter priority

WordPress Trac noreply at wordpress.org
Fri Jan 2 03:28:54 UTC 2015


#30875: enforce integers in add_filter priority
------------------------------------------+------------------------------
 Reporter:  drrobotnik                    |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Awaiting Review
Component:  Plugins                       |     Version:  4.1
 Severity:  normal                        |  Resolution:
 Keywords:  has-patch dev-feedback close  |     Focuses:
------------------------------------------+------------------------------

Comment (by dd32):

 In that case, I'd just leave non-numeric strings out of it entirely, but
 still don't believe it'd be something worth documenting or preventing.

 The odd ordering you're coming up against is, I think, caused by PHP's
 typecasting,  comparing `1` to `'2'` will typecast the numeric-string to
 an int, but comparing `7.2'` to `'micky'` won't, and it'll perform a
 string comparison, the order in which this happens, plus the type of sort
 PHP uses, would explain the ordering you're seeing.

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


More information about the wp-trac mailing list