#34241 [Opn->Bgs]: unexpected references behavior
| From: | derick@php.net | Date: | Wed, 24 Aug 2005 20:09:50 +0000 |
| Subject: | #34241 [Opn->Bgs]: unexpected references behavior | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83958@lists.php.net to get a copy of this message | ||
ID: 34241
Updated by: derick@php.net
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