php.net |  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
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: afuzaylov at mlgpro dot com
New email:
PHP Version: OS:

 

 [2007-02-16 20:06 UTC] afuzaylov at mlgpro dot com
Description:
------------
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);

$process->__destruct();

Expected result:
----------------
All the vars should be destroyed.

Actual result:
--------------
The vars stay in memory

Patches

Pull Requests

History

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

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] tony2001@php.net
unset()
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 15:01:30 2025 UTC