|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-03-29 19:41 UTC] felipe@php.net
[2008-03-31 12:13 UTC] wursttrooper at gmx dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 22:00:02 2025 UTC |
Description: ------------ When using a func return value by reference as constructor argument, produces Fatal error: Can't use method return value in write context in D:\xampplite\htdocs\test\writectx.php on line 22 removing by ref '&' symbol lets code execute. Reproduce code: --------------- <? class MyClass { function func1() { return "ret func1"; } } class MyClass2 { function __construct( $str, $obj ) { } } $obj= new MyClass(); /****************** Fatal error: Can't use method return value in write context in D:\xampplite\htdocs\test\writectx.php on line 22 ******************/ $c2 = new MyClass2("sf",&$obj->func1()); /****************** works ******************/ $c2 = new MyClass2("sf",$obj->func1()); ?>