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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 19:01:33 2024 UTC