#44565 [Opn->Bgs]: constructor argument by reference return value
| From: | felipe@php.net | Date: | Sat, 29 Mar 2008 19:41:21 +0000 |
| Subject: | #44565 [Opn->Bgs]: constructor argument by reference return value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-123768@lists.php.net to get a copy of this message | ||
ID: 44565
Updated by: felipe@php.net
Reported By: wursttrooper at gmx dot de
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
See:
- http://docs.php.net/manual/en/language.references.pass.php
Previous Comments:
------------------------------------------------------------------------
[2008-03-29 16:42:01] wursttrooper at gmx dot de
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());
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44565&edit=1