[wp-trac] [WordPress Trac] #25160: Unnecessarily passing $this by reference in core

WordPress Trac noreply at wordpress.org
Sun Jan 4 21:59:59 UTC 2015


#25160: Unnecessarily passing $this by reference in core
---------------------------------+-----------------------------
 Reporter:  jdgrimes             |       Owner:
     Type:  defect (bug)         |      Status:  closed
 Priority:  normal               |   Milestone:  Future Release
Component:  General              |     Version:
 Severity:  normal               |  Resolution:  fixed
 Keywords:  has-patch 3.9-early  |     Focuses:  performance
---------------------------------+-----------------------------
Changes (by wonderboymusic):

 * keywords:  has-patch needs-testing needs-codex 3.9-early => has-patch
     3.9-early
 * status:  new => closed
 * resolution:   => fixed


Comment:

 You are correct - I hate PHP:
 {{{
 class Test_Me {
     function __construct() {
         do_action( 'woo', $this );
     }
 }

 function __woo( &$ref ) {

 }

 add_action( 'woo', '__woo' );

 new Test_Me();
 exit();
 }}}

 We aren't gonna touch those, marking as fixed.
 Produces:
 `PHP Warning:  Parameter 1 to __woo() expected to be a reference, value
 given`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25160#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list