bug63635.phpt 656 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --TEST--
  2. Bug #63635 (Segfault in gc_collect_cycles)
  3. --FILE--
  4. <?php
  5. class Node {
  6. public $parent = NULL;
  7. public $childs = array();
  8. function __construct(Node $parent=NULL) {
  9. if ($parent) {
  10. $parent->childs[] = $this;
  11. }
  12. $this->childs[] = $this;
  13. }
  14. function __destruct() {
  15. $this->childs = 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. --EXPECT--
  34. 0
  35. 1
  36. 2
  37. 3
  38. 4
  39. 5
  40. 6
  41. 7
  42. 8
  43. 9
  44. 10
  45. 11
  46. 12
  47. 13
  48. 14
  49. 15
  50. 16
  51. 17
  52. 18
  53. 19
  54. ok