Bug #68370 [Opn->Fbk]: "unset($this)" can make the program crash

From: Date: Fri, 07 Nov 2014 13:18:58 +0000
Subject: Bug #68370 [Opn->Fbk]: "unset($this)" can make the program crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188507@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68370&edit=1

 ID:                 68370
 Updated by:         aharvey@php.net
 Reported by:        drewparoski at gmail dot com
 Summary:            "unset($this)" can make the program crash
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Reproducible crash
 Operating System:   CentOS Linux 6.3
 PHP Version:        5.6.2
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php
for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2014-11-07 09:06:06] drewparoski at gmail dot com

Description:
------------
Doing "unset($this);" inside a non-static method can make the program crash.

I provided an example that crashes on PHP 5.3.0 - 5.6.2.

Test script:
---------------
<?php
class C {
  public function test() {
    unset($this);
    return get_defined_vars();
  }
}
$c = new C();
$x = $c->test();
unset($c, $x);
echo "Done\n";

Expected result:
----------------
Done

Actual result:
--------------
Segmentation fault


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



--
Edit this bug report at https://bugs.php.net/bug.php?id=68370&edit=1


Thread (5 messages)

« previous php.bugs (#188507) next »