#20064 [Ver->Bgs]: print_r is still incorrect with referenced objects
| From: | iliaa@php.net | Date: | Mon, 10 Feb 2003 17:00:17 +0000 |
| Subject: | #20064 [Ver->Bgs]: print_r is still incorrect with referenced objects | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-32654@lists.php.net to get a copy of this message | ||
ID: 20064
Updated by: iliaa@php.net
Reported By: laca@webart.hu
-Status: Verified
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: W2K
PHP Version: 4.3.0-dev
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
The 1st instance of recursion is always shown. Consider
print_r($GLOBALS);
Previous Comments:
------------------------------------------------------------------------
[2002-10-24 12:21:04] laca@webart.hu
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