ID: 20064
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Verified
Bug Type: Scripting Engine problem
Operating System: W2K
-PHP Version: 4.2.3
+PHP Version: 4.3.0-dev
Previous Comments:
------------------------------------------------------------------------
[2002-10-24 12:21:04] [EMAIL PROTECTED]
Running the code below shows that $cls->tProperty is _NOT_ the same
variable as the object itself. However, it should be. It lies that
$cls->tProperty is another instance of tClass class. Despite of this,
when one changes the name property, it will result in change in both
objects, and that's correct.
class tClass {
var $tProperty;
var $name;
function tClass() {
$this->tProperty =& $this;
}
};
echo "<pre>";
$cls =& new tClass();
$cls->name = "Sam";
print_r($cls);
$cls->name = "George";
print_r($cls);
echo "</pre>";
/*
----------------------------
Output:
----------------------------
tclass Object
(
[tProperty] => tclass Object
(
[tProperty] => *RECURSION*
[name] => Sam
)
[name] => Sam
)
tclass Object
(
[tProperty] => tclass Object
(
[tProperty] => *RECURSION*
[name] => George
)
[name] => George
)
----------------------------
Instead of:
----------------------------
tclass Object
(
[tProperty] => *RECURSION*
[name] => Sam
)
tclass Object
(
[tProperty] => *RECURSION*
[name] => George
)
*/
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20064&edit=1