#33319 [Opn->Bgs]: Cannot re-assign $this

From: Date: Sun, 12 Jun 2005 22:47:59 +0000
Subject: #33319 [Opn->Bgs]: Cannot re-assign $this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-80205@lists.php.net to get a copy of this message
ID: 33319 Updated by: helly@php.net Reported By: sailormax at gmail dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: WinXP PHP Version: 5.1.0b1 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 You change $this into a reference here. Thus you still try to change it. Previous Comments: ------------------------------------------------------------------------ [2005-06-13 00:36:05] sailormax at gmail dot com But I don't re-assign "$this"! I re-assign "$obj"! Why I can't do this? ------------------------------------------------------------------------ [2005-06-12 23:22:14] derick@php.net 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 so don\'t assign it by reference... ------------------------------------------------------------------------ [2005-06-12 23:12:58] sailormax at gmail dot com Description: ------------ class member function do not accept bind to any variable address of $this. I do not want edit "$this"! I want work with it by another variable! (zend.ze1_compatibility_mode = On) Reproduce code: --------------- <? class foo { function test($obj = '') { if ($obj == '') $obj =& $this; } } ?> Expected result: ---------------- everything must be ok Actual result: -------------- Fatal error: Cannot re-assign $this in index.php on line 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33319&edit=1

« previous php.bugs (#80205) next »