[wp-trac] [WordPress Trac] #10535: _wp_filter_build_unique_id issues with the first time a filter is hooked by a class

WordPress Trac wp-trac at lists.automattic.com
Tue Sep 7 14:12:52 UTC 2010


#10535: _wp_filter_build_unique_id issues with the first time a filter is hooked by
a class
-------------------------------------+--------------------------------------
 Reporter:  simonwheatley            |        Owner:          
     Type:  defect (bug)             |       Status:  reopened
 Priority:  normal                   |    Milestone:  3.0.2   
Component:  Plugins                  |      Version:  2.9     
 Severity:  normal                   |   Resolution:          
 Keywords:  has-patch tested commit  |  
-------------------------------------+--------------------------------------

Comment(by hakre):

 While having the fingers in the file (Related: #14789), I just created
 this:

 '''PHP 4.2.0+ code to obtain unique object id per request:'''

 As spl_object_hash is not available on WP's current minimum PHP
 requirements:

 {{{
 ob_start();
 debug_zval_dump( $some_object_instance );
 list( $object_id ) = explode(' ', ob_get_clean(), 2);
 echo $object_id;
 }}}

 '''Design Flaw on Function / Static Class Function (same unique ID per
 different callback)'''

 {{{
 class myplugin {
   static function _breaks() {
   }
 }

 function myplugin_breaks() {
 }
 }}}

 Register both on the same hook with the same priority. The later will
 overwrite the first one or vice-versa.

 Suggested fix: add {{{::}}} between class name and static function name.

 ----

 With both suggestions the function it should be possible to make the
 function more safe in handling data.

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


More information about the wp-trac mailing list