ID: 36357 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Assigned +Status: Bogus Bug Type: Class/Object related Operating System: Any PHP Version: 5.1.2 Assigned To: dmitry New Comment:
$tmp =& $this is proper code (it can be dangerous, but this doesn't mean improper). Removing support for assignment and passing $this by reference will break a lot of existing PHP scripts. Previous Comments: ------------------------------------------------------------------------ [2006-02-10 17:05:54] [EMAIL PROTECTED] Description: ------------ Using =&, it is possible to modify $this with the constructor. This shouldn't be allowed, just like for $tmp = $this; Reproduce code: --------------- <?php class B { function B() { } } class A { function A() { $tmp =& $this; var_dump($this); // outputs : object(A) $tmp = new B(); var_dump($this); // outputs : object(B) } } $a = new A(); var_dump($a); // outputs : object(A) ?> Expected result: ---------------- object(A)#1 (0) { } object(A)#2 (0) { } object(A)#1 (0) { } // current result : object(A)#1 (0) { } object(B)#2 (0) { } object(A)#1 (0) { } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36357&edit=1