bug63635.phpt 784 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. --TEST--
  2. Bug #63635 (Segfault in gc_collect_cycles)
  3. --FILE--
  4. <?php
  5. class Node {
  6. public $parent = NULL;
  7. public $children = array();
  8. function __construct(Node $parent=NULL) {
  9. if ($parent) {
  10. $parent->children[] = $this;
  11. }
  12. $this->children[] = $this;
  13. }
  14. function __destruct() {
  15. $this->children = NULL;
  16. }
  17. }
  18. define("MAX", 16);
  19. for ($n = 0; $n < 20; $n++) {
  20. $top = new Node();
  21. for ($i=0 ; $i<MAX ; $i++) {
  22. $ci = new Node($top);
  23. for ($j=0 ; $j<MAX ; $j++) {
  24. $cj = new Node($ci);
  25. for ($k=0 ; $k<MAX ; $k++) {
  26. $ck = new Node($cj);
  27. }
  28. }
  29. }
  30. echo "$n\n";
  31. }
  32. echo "ok\n";
  33. ?>
  34. --EXPECT--
  35. 0
  36. 1
  37. 2
  38. 3
  39. 4
  40. 5
  41. 6
  42. 7
  43. 8
  44. 9
  45. 10
  46. 11
  47. 12
  48. 13
  49. 14
  50. 15
  51. 16
  52. 17
  53. 18
  54. 19
  55. ok