ID: 36971
Updated by: [EMAIL PROTECTED]
Reported By: k at phpkoala dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 5.1.2
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"It is not possible to unset $this inside an object method since PHP
5."
Previous Comments:
------------------------------------------------------------------------
[2007-07-18 13:53:56] scott at utnow dot com
This is really quite simple to understand folks...
The guy has a class that is sitting there doing it's thing.
He has a function (say it's 'DestroyMe') that should do simply that.
The best case I can imagine...
The class is 'object' and it interfaces with a row in a table in a
database.
If you're going to delete the object's row from the table, it probably
makes sense to destroy the class handling it.
function destroy() { delete row; destruct class; }
Thus it would be helpful to be able to do what he's asking.
Now whether it fits within the realm of responsible coding or not I'm
not the judge... lol
------------------------------------------------------------------------
[2007-04-07 01:10:43] edwardzyang at thewritingpot dot com
It's tough to understand what your problem is without more code. If you
are doing:
for ($i = 0; $i < 1000000; $i++) {
$obj = new Foo();
// do stuff with $obj
unset($obj);
}
That should be sufficient. Could you be more specific?
Usually, if the PHP interpreter is running out of memory, you've got
some bad code that needs refactoring.
------------------------------------------------------------------------
[2007-04-06 20:41:05] joel at propbot dot com
The problem comes into mind when your creating an object and going
through a loop. The script just grows and grows until your out of
memory.
We are creating an object doing what we need to do with it and trying
to destroy it. Anybody have a solution?
I really don't want to have to go through every variable inside the
object and do an unset().
------------------------------------------------------------------------
[2006-07-06 15:52:14] [EMAIL PROTECTED]
It's absurd (well, maybe not absurd, but not needed) as long as PHP has
destructor methods.
------------------------------------------------------------------------
[2006-07-06 15:41:19] keko_metal at hotmail dot com
Scott, do you really think that
$object->im_done_please_kill_me() is an absurd idea?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/36971
--
Edit this bug report at http://bugs.php.net/?id=36971&edit=1