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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: felipensp at gmail dot com
New email:
PHP Version: OS:

 

 [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 00:01:30 2024 UTC