From: phpbug at wethmar dot demon dot nl Operating system: linux, 2.6 kernel, apache 2.6 PHP version: 5.1.0RC1 PHP Bug Type: Class/Object related Bug description: cannot re-assing $this
Description: ------------ Code witch works in PHP4 and 5.0 results in an error in 5.1.0 rc1: PHP Fatal error: Cannot re-assign $this. It can be fixed by removing the &. May be its no bug, but the error message is not clear to me: $this isn't assigned; $temp is. Reproduce code: --------------- <html> <body> <? class test { function doit() { $temp = &$this; return $temp; } } $obj = new test; $result = $obj->doit(); ?> Ok<br> </body> </html> Expected result: ---------------- OK Actual result: -------------- [Tue Sep 13 12:36:28 2005] [error] [client 192.168.100.46] PHP Fatal error: Cannot re-assign $this in /home/httpd/sites/devrw/root/test.php on line 7 -- Edit bug report at http://bugs.php.net/?id=34490&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34490&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34490&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34490&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34490&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34490&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34490&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34490&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34490&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34490&r=support Expected behavior: http://bugs.php.net/fix.php?id=34490&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34490&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34490&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34490&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34490&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34490&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34490&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34490&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34490&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34490&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34490&r=mysqlcfg