ID:               17498
 Comment by:       qwerty at ut dot ee
 Reported By:      mikx at mikx dot de
 Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Windows XP
 PHP Version:      4.2.1
 New Comment:

in RedHat php-4.2.2 i have noticed thisproblem (is it fixed in some
newer version of PHP?):

======PHP CODE STARTS=========
<?php

class test {
        var $nr = 0;
        var $sub1 = null;

        function test() {
                $this->sub1 =& new sub(&$this);
                $this->nr++;
        }
}

class sub {
        var $parent = null;

        function sub($pObj) {
                $this->parent = &$pObj;
        }
}


$mytest =& new test();

print_r($mytest);
?>

======PHP CODE ENDS=========

and outout is following:

test Object
(
    [nr] => 1
    [sub1] => sub Object
        (
            [parent] => test Object
                (
                    [nr] => 1
                    [sub1] =>  *RECURSION*
                )

        )

)

but the problem is: the *RECURSION* must allready be in [parent]
because the [parent] is a pointer/reference to parent object...

am i right or wrong ?

in more complicated solutions where are more objects that use 
references to their parents, print_r()  can not handle the recursion
well and results in an infinite loop...


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

[2002-10-19 17:05:33] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------

[2002-05-29 13:07:18] [EMAIL PROTECTED]

You don't have to report the same bug report.
We know it, it's just nobody care to fix it.



------------------------------------------------------------------------

[2002-05-28 20:35:39] mikx at mikx dot de

There is a note in the documentation that since PHP 4.0.4 infinite loop
situations like print_r($GLOBALS) are handled and get stopped. But
there are still situations print_r() results in an infinite loop:

foreach($GLOBALS as $i) 
{ 
print_r($GLOBALS); 
}


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17498&edit=1

Reply via email to