#44565 [NEW]: constructor argument by reference return value
| From: | wursttrooper at gmx dot de | Date: | Sat, 29 Mar 2008 16:42:01 +0000 |
| Subject: | #44565 [NEW]: constructor argument by reference return value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-123759@lists.php.net to get a copy of this message | ||
From: wursttrooper at gmx dot de
Operating system: Linux
PHP version: 5.2.5
PHP Bug Type: *Compile Issues
Bug description: constructor argument by reference return value
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 bug report at http://bugs.php.net/?id=44565&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44565&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44565&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44565&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44565&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=44565&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44565&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44565&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44565&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44565&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44565&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=44565&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=44565&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44565&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44565&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44565&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44565&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44565&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44565&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44565&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44565&r=mysqlcfg