php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36167 Wrong count of the references to object
Submitted: 2006-01-26 16:27 UTC Modified: 2006-01-27 16:12 UTC
From: mail at ejika dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.1.2 OS: Windows 2000, Free BSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mail at ejika dot net
New email:
PHP Version: OS:

 

 [2006-01-26 16:27 UTC] mail at ejika dot net
Description:
------------
Wrong count of the references to object.
And wrong define object lifetime.

Reproduce code:
---------------
class A   
{   
    function __construct()  
    { 
        echo 'A::__construct()<br>'; 
    }  
       
    function foo()   
    {   
        echo 'foo();<br>';   
    }   
       
    function __destruct()   
    {   
        echo 'A::__destruct()<br>';   
    }   
}   

    
    
class Test   
{   
    private $a;

    function __construct( & $a )   
    {   
        $this->a = $a;
        echo 'Test::__construct()<br>'; 
    }   

    function __destruct()   
    {   
        $this->a->foo();
        echo 'Test::__destruct()<br>';   
    }   
}   

$a = new A();   
$t = new Test( $a );

Expected result:
----------------
A::__construct()
Test::__construct()
foo();
A::__destruct()
Test::__destruct()

Actual result:
--------------
A::__construct()
Test::__construct()
A::__destruct()
foo();
Test::__destruct()

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-26 16:48 UTC] tony2001@php.net
See bug #33348
 [2006-01-27 16:12 UTC] mail at ejika dot net
Php don't clean memory using by object after __destruction of object request.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 13 10:01:27 2025 UTC