bug24635.phpt 648 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Bug #24635 (crash on dtor calling other functions)
  3. --FILE--
  4. <?php
  5. class SiteClass {
  6. function __construct() { $this->page = new PageClass(); }
  7. }
  8. class PageClass {
  9. function Display() {
  10. $section = new SectionClass("PageClass::Display");
  11. }
  12. }
  13. class SectionClass {
  14. function __construct($comment) {
  15. $this->Comment = $comment;
  16. }
  17. function __destruct() {
  18. out($this->Comment); // this line doesn't crash PHP
  19. out("\n<!-- End Section: " . $this->Comment . "-->"); // this line
  20. }
  21. }
  22. function out($code) { return; }
  23. $site = new SiteClass();
  24. $site->page->Display();
  25. echo "OK\n";
  26. ?>
  27. --EXPECT--
  28. OK