bug36006.phpt 590 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #36006 (Problem with $this in __destruct())
  3. --FILE--
  4. <?php
  5. class Person {
  6. public $dad;
  7. public function __destruct() {
  8. $this->dad = null; /* no segfault if this is commented out */
  9. }
  10. }
  11. class Dad extends Person {
  12. public $son;
  13. public function __construct() {
  14. $this->son = new Person;
  15. $this->son->dad = $this; /* no segfault if this is commented out */
  16. }
  17. public function __destruct() {
  18. $this->son = null;
  19. parent::__destruct(); /* segfault here */
  20. }
  21. }
  22. $o = new Dad;
  23. unset($o);
  24. echo "ok\n";
  25. ?>
  26. --EXPECT--
  27. ok