﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
8723	Instances of same class that call variable hook first generate same wp_filter_id	bkrausz	jacobsantos	"Best shown by example:
{{{
<?php
class Foo {
  var $i;
  function Foo($i) {
    $this->i = $i;
    add_action('something'.$i, array(&$this, 'bar'));
    add_action('init', array(&$this, 'baz'));
  }
  function bar() {}
  function baz() {
    echo $this->i;
  }
}

new Foo(1);
new Foo(2);
?>
}}}

This results in only seeing ""2"".  This is because _wp_filter_build_unique_id sets $function[0]->wp_filter_id to 0 for both.  The following line is the issue:

{{{
$count = isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
}}}

Since add_action is being called for the instance for a unique $tag in its first instance, $wp_filter[$tag][$priority] is empty for both instances...there should be some way to prevent this.

This may seem like a rare case, but I had to hunt this down for my plugin when the first action was:
{{{
add_action('wp_ajax_add-' . $this->slug, array(&$this, 'ajax_add'));
}}}

The fix is trivial: call add_action on something with a static name first, but is difficult to discover.
"	defect (bug)	closed	normal	2.8	Plugins	2.7	major	fixed	trac-attention	westi
