ID:               36971
 Comment by:       henke dot andersson at comhem dot se
 Reported By:      k at phpkoala dot com
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      5.1.2
 New Comment:

In php5 no php variable actualy contains the object instances, they
contains pointers to instances. Thats why unseting the $this variable
does nothing. Just because you stop knowing where it is doesn't mean it
ceases to exist.
And the $this variable is a special case. It would not make sence to
unset it.
As far as I can understand, $this shouldn't even affect the garbage
collection, if it did(and php doesn't adjust for recurive pointers) the
garbage collection would never destroy objects instances!


Previous Comments:
------------------------------------------------------------------------

[2006-05-04 10:31:02] gixxman at gmali dot com

class FalseClass
{
        public function __destruct()
        {
                echo "Gonna die, man";
        }
}

$f = new FalseClass;
unset($f);


RESULTS:

Gonna die, man

------------------------------------------------------------------------

[2006-04-05 19:04:17] k at phpkoala dot com

Thanks Scott, that makes sense.

Does that mean there is no way to accomplish this in PHP5? I guess so.

I'd like to see this added to the docs.

------------------------------------------------------------------------

[2006-04-05 06:21:38] [EMAIL PROTECTED]

@Scott: totally true.

This can ofcourse be mentioned in the documentation if it's not already
there...

------------------------------------------------------------------------

[2006-04-04 23:53:40] scottmacvicar at ntlworld dot com

Destroying an object internally is an absurd concept, how can you
destroy something that is currently in the scope of execution?

The reason it works in PHP 4 and not in PHP 5 is that object types are
no longer mutable.

------------------------------------------------------------------------

[2006-04-04 23:18:38] k at phpkoala dot com

Mike, I am serious or I would not have taken the time to post this bug
report.

The manual page for unset, over at
http://www.php.net/manual/en/function.unset.php, does not mention this
change in functionality. Like I said in my first message, this is
something that works in PHP4 but no longer works in PHP5.

If you can't believe I am serious, please point out why you think this
is a joke? How do you destroy a class instance internally in PHP5? And
if this is never going to happen, can't you say this in the manual,
along with an explanation?

If nothing else, the very fact that it worked in PHP4 and does not work
in PHP5 should merit a mention in the documentation. (Just Google for
this issue and you will see many pieces of software that have broken
because of this, when used on PHP5.)

Back to you, Mike.

------------------------------------------------------------------------

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

Reply via email to