Make WordPress Core

Ticket #30875: plugin.patch

File plugin.patch, 595 bytes (added by drrobotnik, 10 years ago)

return false if priority provided is not an integer.

  • wp-includes/plugin.php

    diff --git a/wp-includes/plugin.php b/wp-includes/plugin.php
    index 27a65ee..684ea0a 100644
    a b if ( ! isset( $wp_current_filter ) ) 
    8181function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
    8282        global $wp_filter, $merged_filters;
    8383
     84        if( !is_int($priority) )
     85                return false;
     86
    8487        $idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
    8588        $wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args);
    8689        unset( $merged_filters[ $tag ] );