|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-04-02 20:19 UTC] stas@php.net
[2007-04-03 08:32 UTC] sir dot mordred dot service at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 17:00:01 2025 UTC |
Description: ------------ If a parameter passed by reference to a function is assigned a new object with the =& operator, after the function call the variable passed to the function will not contain the object, but its previous value (or null). Assignment with = works fine. Reproduce code: --------------- <pre><?php class A {} function Foo(&$param) { $param =& new A(); } function Bar(&$param) { $param = new A(); } echo phpversion()."\n"; $p = 1; Foo($p); var_dump($p); $q = 1; Bar($q); var_dump($q); ?> Expected result: ---------------- 4.4.6 object(a)(0) { } object(a)(0) { } Actual result: -------------- 4.4.6 int(1) object(a)(0) { }