[wp-trac] [WordPress Trac] #11663: Return by Referenced missed - PHP4 Compat

WordPress Trac wp-trac at lists.automattic.com
Tue Dec 29 18:45:33 UTC 2009


#11663: Return by Referenced missed - PHP4 Compat
--------------------------+-------------------------------------------------
 Reporter:  hakre         |       Owner:     
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.0
Component:  General       |     Version:  2.9
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------
 There might be various points where is not properly taken care of the PHP
 4 compability. One part is to take care of passing/returning  objects be
 reference to/from functions.

 Before sniffing the overall code, I create this ticket for reference and
 to provide first examples so that a decision can be made, how to deal with
 / merge patches etc. .

 == Pass by Reference ==
 function parameters that accept objects need to set as ''pass by
 reference'':
 {{{
 function foo(&$var)
 }}}

 == Return by Reference ==
 Functions that return objects need to be set as ''return by reference'' so
 that the actual object and not a copy is returned in php 4:
 {{{
 function &bar() {
   $obj = new Object();
   return $obj;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11663>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list