php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43335 Unset $this inside a method
Submitted: 2007-11-19 12:29 UTC Modified: 2007-11-19 13:16 UTC
From: felipensp at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3CVS-2007-11-19 (snap) OS:
Private report: No CVE-ID: None
 [2007-11-19 12:29 UTC] felipensp at gmail dot com
Description:
------------
Manual says:
"Note: It is not possible to unset $this inside an object method since PHP 5."

Reproduce code:
---------------
<?php

class foo {
  public function __construct() {
    unset($this);
    var_dump($this);
  }
}

new foo;

Expected result:
----------------
object(foo)#1 (0) {
}


Actual result:
--------------
NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-19 13:16 UTC] jani@php.net
It means it doesn't have any effect except inside that method..
And this isn't any different from how it works in 5.2 -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 10:01:30 2024 UTC