[wp-trac] [WordPress Trac] #13757: Passing functions as call by ref parameter should be avoided

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 25 07:24:56 UTC 2010


#13757: Passing functions as call by ref parameter should be avoided
------------------------------+---------------------------------------------
 Reporter:  TobiasBg          |       Owner:  westi    
     Type:  defect (bug)      |      Status:  new      
 Priority:  normal            |   Milestone:  3.0.1    
Component:  Warnings/Notices  |     Version:           
 Severity:  normal            |    Keywords:  has-patch
------------------------------+---------------------------------------------
Changes (by nacin):

  * milestone:  3.1 => 3.0.1


Comment:

 Currently running some tests on a 5.0.5 install, where this causes a fatal
 error. Thus, this the same bug as #14160.

 The easiest fix, as noted in one of the PHP bugs linked to from #14160, is
 just assigning a variable first. Thus,
 {{{
 $last_element_index = array_pop( array_keys( $my_array ) );
 }}}
 becomes:
 {{{
 $last_element_index = array_pop( $var_by_ref = array_keys( $my_array ) );
 }}}

 I'm going to look through the instances cited in this patch and try to
 fix. (Pretty much what TobiasBg said.) We can then soak the rest in trunk
 come 3.1 development.

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


More information about the wp-trac mailing list