ID:               22855
 Updated by:       [EMAIL PROTECTED]
 Reported By:      knizhnik at garret dot ru
-Status:           Open
+Status:           Bogus
 Bug Type:         Zend Engine 2 problem
 Operating System: Windows and Linux
 PHP Version:      4.3.1
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.


There are at least 3 or 4 reports similar or about exactly the same
issue..so please search the bug database first.



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

[2003-03-24 12:06:38] knizhnik at garret dot ru

PHP is using reference counter garbage collection so it is not able to
deallocate objects with cyclic references. But
it should not be a reason for corrupting memory. The following example
cause either loosing value of object property either segmentation fault
at PHP 4.3.1 and PHP-4.3.2RC1. The fault takes place after inserting
65533
objects (0xfffd - looks like somewhere short type is used:).
In first case after inserting about 65k of objects the system reports
"PHP Notice:  Undefined property:" when 
accessing "opened" field in storeObject.


<?php


class Storage { 
    var $opened;
    var $count;

    function Storage() { 
        $this->objByOidMap = array();
        $this->opened = true;
        $this->count = 0;
    }

    function storeObject(&$obj) {
        if ($this->opened) { 
            if ($obj->__oid__ == 0) {   
                $this->count += 1;
                $obj->__oid__ = $this->count;
                $obj->__storage__ = &$this;
                $this->objByOidMap[$obj->__oid__] = &$obj;
            }
        }
    }
}

class Object {
    var $__storage__;
    var $__oid__;
}

$storage = &new Storage();
for ($i = 0; $i < 100000; $i++) {
    print("i=$i\n");
    $obj = &new Object();
    $storage->storeObject($obj);
}

?>


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


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

Reply via email to