mirror of
https://github.com/php/php-src.git
synced 2024-12-25 01:40:50 +08:00
40 lines
471 B
PHP
40 lines
471 B
PHP
--TEST--
|
|
Bug #70805 (Segmentation faults whilst running Drupal 8 test suite) (Memleak)
|
|
--INI--
|
|
zend.enable_gc = 1
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
}
|
|
|
|
class B {
|
|
}
|
|
|
|
class C {
|
|
public function __destruct() {
|
|
if (isset($GLOBALS["a"])) {
|
|
unset($GLOBALS["a"]);
|
|
}
|
|
}
|
|
}
|
|
|
|
$a = new A;
|
|
$a->b = new B;
|
|
$a->b->a = $a;
|
|
|
|
$i = 0;
|
|
|
|
while ($i++ < 9999) {
|
|
$t = [];
|
|
$t[] = &$t;
|
|
unset($t);
|
|
}
|
|
$t = [new C];
|
|
$t[] = &$t;
|
|
unset($t);
|
|
|
|
unset($a);
|
|
var_dump(gc_collect_cycles());
|
|
--EXPECT--
|
|
int(2)
|