ID: 33352 Updated by: [EMAIL PROTECTED] Reported By: cmoore at iyd dot com Status: Open Bug Type: Documentation problem Operating System: Gentoo Linux PHP Version: Irrelevant New Comment:
Fur further reference: it was added for the sake of bug #29877. Previous Comments: ------------------------------------------------------------------------ [2005-06-15 15:58:23] cmoore at iyd dot com Description: ------------ On the document page: http://us2.php.net/manual/en/language.references.return.php "& by function definition is optional in class methods." Reproduce code: --------------- <? class reftest { var $var = "original"; function by_copy() { return $this->var; } } print "By copy:\n"; $t = new reftest; var_dump($t); $c =& $t->by_copy(); $c = "copy"; var_dump($t); Expected result: ---------------- According to docs, $c should be a reference to the class variable. $t->c should have the value "copy" in the output from the last var_dump. When an ampersand is prefixed on the function by_copy(), it works as expected. Actual result: -------------- as demonstrated by the above code, a copy is returned. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33352&edit=1