Bug #68370 [NEW]: "unset($this)" can make the program crash

From: Date: Fri, 07 Nov 2014 09:06:07 +0000
Subject: Bug #68370 [NEW]: "unset($this)" can make the program crash
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188500@lists.php.net to get a copy of this message
From:             drewparoski at gmail dot com
Operating system: CentOS Linux 6.3
PHP version:      5.6.2
Package:          Reproducible crash
Bug Type:         Bug
Bug description:"unset($this)" can make the program crash

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 bug report at https://bugs.php.net/bug.php?id=68370&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=68370&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=68370&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=68370&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=68370&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=68370&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=68370&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=68370&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=68370&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=68370&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=68370&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=68370&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=68370&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=68370&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68370&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=68370&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=68370&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=68370&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68370&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=68370&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=68370&r=mysqlcfg



Thread (5 messages)

« previous php.bugs (#188500) next »