bug70805_2.phpt 510 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Bug #70805 (Segmentation faults whilst running Drupal 8 test suite) (Memleak)
  3. --INI--
  4. zend.enable_gc = 1
  5. --FILE--
  6. <?php
  7. class A {
  8. }
  9. class B {
  10. }
  11. class C {
  12. public function __destruct() {
  13. if (isset($GLOBALS["a"])) {
  14. unset($GLOBALS["a"]);
  15. }
  16. }
  17. }
  18. $a = new A;
  19. $a->b = new B;
  20. $a->b->a = $a;
  21. $i = 0;
  22. while ($i++ < 9999) {
  23. $t = [];
  24. $t[] = &$t;
  25. unset($t);
  26. }
  27. $t = [new C];
  28. $t[] = &$t;
  29. unset($t);
  30. unset($a);
  31. var_dump(gc_collect_cycles());
  32. ?>
  33. --EXPECT--
  34. int(2)