ID: 34241 User updated by: tuft at centrum dot cz Reported By: tuft at centrum dot cz Status: Bogus Bug Type: Class/Object related Operating System: windows xp PHP Version: 5.0.4 New Comment:
I read throw the documentation and I haven't found any notice about this strange behavior. The documentation says that $this is reference to the instance of object (even in new php5 00 model), documentation also says that reference is not pointer when you create reference to variable both variables are equal, they point to the same place. But in our situation $this behave like pointer. So I think there is a mistake somewhere, in the documentation or in the php5 OO model. It would be nice if at least $var = &$this worked in php5 for compatibility. IMHO the whole new OO model should be compatible with the old one, but it do not belong here(my dream / future request). Thanks for your time and for developing such nice scripting language. Previous Comments: ------------------------------------------------------------------------ [2005-08-24 22:09:49] [EMAIL PROTECTED] 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 This is PHP 5\'s new OO model for you. ------------------------------------------------------------------------ [2005-08-24 21:57:46] tuft at centrum dot cz Description: ------------ when I call "$variable = $this" inside the class it will create only reference, it won't create new instance of object(it behave exactly like "$variable = &$this" should behave) and "$variable = &$this" don't do anything. Reproduce code: --------------- class A { var $t = "Original <br>"; function A() { global $active; $active = $this; } function test(){echo $this->t;} } function f() { global $active; $active->t = "Changed <br>"; $active->test(); } $a = new A(); $a->test(); f(); $a->test(); Expected result: ---------------- Original Changed Original Actual result: -------------- Original Changed Changed ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34241&edit=1
