Make WordPress Core

Changeset 11409


Ignore:
Timestamp:
05/20/2009 04:59:01 PM (16 years ago)
Author:
ryan
Message:

Make sure filter IDs are unique. Props bkrausz, hakre. fixes #8723

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/plugin.php

    r11072 r11409  
    666666 * @global array $wp_filter Storage for all of the filters and actions
    667667 * @param string $tag Used in counting how many hooks were applied
    668  * @param string|array $function Used for creating unique id
     668 * @param callback $function Used for creating unique id
    669669 * @param int|bool $priority Used in counting how many hooks were applied.  If === false and $function is an object reference, we return the unique id only if it already has one, false otherwise.
    670670 * @param string $type filter or action
    671  * @return string Unique ID for usage as array key
     671 * @return string|bool Unique ID for usage as array key or false if $priority === false and $function is an object reference, and it does not already have a uniqe id.
    672672 */
    673673function _wp_filter_build_unique_id($tag, $function, $priority) {
    674674    global $wp_filter;
     675    static $filter_id_count = 0;
    675676
    676677    // If function then just skip all of the tests and not overwrite the following.
     
    683684            if ( false === $priority )
    684685                return false;
    685             $count = isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
    686             $function[0]->wp_filter_id = $count;
    687             $obj_idx .= $count;
    688             unset($count);
     686            $obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
     687            $function[0]->wp_filter_id = $filter_id_count++;
    689688        } else
    690689            $obj_idx .= $function[0]->wp_filter_id;
Note: See TracChangeset for help on using the changeset viewer.