WordPress.org

Make WordPress Core

Ticket #8723: 8723.patch

File 8723.patch, 1.7 KB (added by hakre, 6 years ago)

Repaired and extended Patch

  • wp-includes/plugin.php

     
    665665 * 
    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. 
    677678        if ( is_string($function) ) 
     
    682683                if ( !isset($function[0]->wp_filter_id) ) { 
    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; 
    691690                return $obj_idx;