[wp-trac] [WordPress Trac] #11663: Return by Referenced missed - PHP4 Compat
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 15 14:55:16 UTC 2010
#11663: Return by Referenced missed - PHP4 Compat
--------------------------+-------------------------------------------------
Reporter: hakre | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: General | Version: 2.9
Severity: normal | Resolution: worksforme
Keywords: dev-feedback |
--------------------------+-------------------------------------------------
Changes (by miqrogroove):
* status: new => closed
* resolution: => worksforme
* milestone: 3.0 =>
Comment:
Cross-posting from #11780 :
In PHP there is no such thing as "return by reference" by the normal
definition. PHP always uses references for return variables. The only
exception is when there's a scope conflict, as in, {{{return
$GLOBALS['abc'];}}} or {{{return $this->var;}}} when PHP implicitly
returns by value.
Most of the examples cited by the other ticket were probably returning
cached objects, which would be maintained as separate copies unless
explicitly referenced when returned.
plugins_api() returned a local variable and needed no special treatment.
I am not aware of any change in this behavior between PHP4 and PHP5.
Enjoy!
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11663#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list