xref: /php-src/Zend/tests/gh13670_001.phpt (revision bb6b659a)
1--TEST--
2GH-13670 001
3--SKIPIF--
4<?php
5// gc_threshold is global state
6if (getenv('SKIP_REPEAT')) die('skip Not repeatable');
7?>
8--FILE--
9<?php
10
11register_shutdown_function(function () {
12    global $shutdown;
13    $shutdown = true;
14});
15
16class Cycle {
17    public $self;
18    public function __construct() {
19        $this->self = $this;
20    }
21    public function __destruct() {
22        global $shutdown;
23        if (!$shutdown) {
24            new Cycle();
25        }
26    }
27}
28
29$defaultThreshold = gc_status()['threshold'];
30for ($i = 0; $i < $defaultThreshold+1; $i++) {
31    new Cycle();
32}
33
34$objs = [];
35for ($i = 0; $i < 100; $i++) {
36    $obj = new stdClass;
37    $objs[] = $obj;
38}
39
40$st = gc_status();
41
42if ($st['runs'] > 10) {
43    var_dump($st);
44}
45?>
46==DONE==
47--EXPECT--
48==DONE==
49