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

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 9 11:24:52 UTC 2010


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

  * keywords:  needs-patch => has-patch


Comment:

 I attached a first pass for a patch.

 Using the regexp {{{array_(pop|push|shift|unshift)+\(\s?\w.+\s?\)}}} I
 grep'd for calls of {{{array_pop}}}, {{{array_push}}}, {{{array_shift}}},
 {{{array_unshift}}} which do not have a variable as its argument.

 This lead to one more instance of such a case in wp-db.php, additionally
 to the above mentioned.

 In the patch, I replaced all the calls with temporary variables (the names
 might not be the best...).

 I intentionally left out the two findings in atomlib.php, as that seems to
 be an external library we are using.

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


More information about the wp-trac mailing list