[wp-trac] [WordPress Trac] #30875: enforce integers in add_filter priority
WordPress Trac
noreply at wordpress.org
Wed Dec 31 22:48:19 UTC 2014
#30875: enforce integers in add_filter priority
--------------------------+-----------------------------
Reporter: drrobotnik | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
The docs say that add_filter should use int values, but there is nothing
enforcing this. Currently the following is perfectly valid and works as
you'd expect an array to sort keys.
add_action('wp_head', 'wrong1', '1');
add_action('wp_head', 'wrong2', '1.7');
add_action('wp_head', 'wrong3', '1.5');
add_action('wp_head', 'wrong4', 'mickeymouse');
add_action('wp_head', 'wrong5', 'donaldduck');
http://cloudup.com/cfqa31pltEE
I've attached a patch that simply returns false, because if you simply
typecast to int, the function who is doing it wrong, will get priority.
Props jorbin for clearly understanding integers.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30875>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list