Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #36006 (Problem with $this in __destruct())
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--TEST-- | ||
Bug #36006 (Problem with $this in __destruct()) | ||
--FILE-- | ||
<?php | ||
|
||
class Person { | ||
public $dad; | ||
public function __destruct() { | ||
$this->dad = null; /* no segfault if this is commented out */ | ||
} | ||
} | ||
|
||
class Dad extends Person { | ||
public $son; | ||
public function __construct() { | ||
$this->son = new Person; | ||
$this->son->dad = $this; /* no segfault if this is commented out */ | ||
} | ||
public function __destruct() { | ||
$this->son = null; | ||
parent::__destruct(); /* segfault here */ | ||
} | ||
} | ||
|
||
$o = new Dad; | ||
unset($o); | ||
echo "ok\n"; | ||
?> | ||
--EXPECT-- | ||
ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters