[wp-trac] Re: [WordPress Trac] #8723: Instances of same class that call variable hook first generate same wp_filter_id

WordPress Trac wp-trac at lists.automattic.com
Wed May 6 13:08:41 GMT 2009


#8723: Instances of same class that call variable hook first generate same
wp_filter_id
--------------------------+-------------------------------------------------
 Reporter:  bkrausz       |       Owner:  jacobsantos     
     Type:  defect (bug)  |      Status:  assigned        
 Priority:  normal        |   Milestone:  2.8             
Component:  Plugins       |     Version:  2.7             
 Severity:  normal        |    Keywords:  has-patch tested
--------------------------+-------------------------------------------------
Changes (by hakre):

  * keywords:  needs-patch needs-testing => has-patch tested


Comment:

 There are two ways to handle it. You can prevent that your class becomes
 the same wp_filter_id over and over again by specifying it yourself before
 registering any hooks.

 {{{
   /* constructor of class Foo */
   function Foo($i) {
     $this->i = $i;
     $this->wp_filter_id = 'Foobar' . $i;
     ...
 }}}

 the patch has been fixed. The patch ensures that objects who do not have
 such a default wp_filter_id set get a unique value attached now (that is
 the intended functionality) even for the same class.

 additionally i corrected the docblocks a bit to clarify parameter types
 and return type description.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/8723#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list