|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40511 __destruct() does not destroy vars $var
Submitted: 2007-02-16 20:06 UTC Modified: 2007-02-16 20:29 UTC
From: afuzaylov at mlgpro dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.1 OS: linux
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.
Block user comment
Status: Assign to:
Bug Type:
From: afuzaylov at mlgpro dot com
New email:
PHP Version: OS:


 [2007-02-16 20:06 UTC] afuzaylov at mlgpro dot com
I have a class that has __destruct() in there.

When I call the $process->__destruct(), shouldn't it destroy the whole class, all the functions and variables associated with it and all the com objects?

Reproduce code:
class CProcess {
  var $fsize;

  function __construct($fsize) {
    $this->$fsize = $fsize;

  function __destruct() {

$process = new CProcess(15);


Expected result:
All the vars should be destroyed.

Actual result:
The vars stay in memory


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-16 20:12 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Nope, it shouldn't.
 [2007-02-16 20:14 UTC] afuzaylov at mlgpro dot com
Then how do I destroy the class completely? I need it destroyed to continue with the next statement...
 [2007-02-16 20:29 UTC]
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 23 02:01:28 2024 UTC