ID:               34241
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tuft at centrum dot cz
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: windows xp
 PHP Version:      5.0.4
 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

This is PHP 5's new OO model for you.


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to