1--TEST--
2Stack limit 004 - Stack limit checks with fixed max_allowed_stack_size (fibers)
3--SKIPIF--
4<?php
5if (!function_exists('zend_test_zend_call_stack_get')) die("skip zend_test_zend_call_stack_get() is not available");
6?>
7--EXTENSIONS--
8zend_test
9--FILE--
10<?php
11
12var_dump(zend_test_zend_call_stack_get());
13
14class Test1 {
15    public function __destruct() {
16        new Test1;
17    }
18}
19
20$callback = function (): int {
21    try {
22        new Test1;
23    } catch (Error $e) {
24        return count($e->getTrace());
25    }
26
27    throw new \Exception();
28};
29
30ini_set('fiber.stack_size', '400K');
31$fiber = new Fiber($callback);
32$fiber->start();
33$depth1 = $fiber->getReturn();
34
35ini_set('fiber.stack_size', '200K');
36$fiber = new Fiber($callback);
37$fiber->start();
38$depth2 = $fiber->getReturn();
39
40var_dump($depth1 > $depth2);
41
42?>
43--EXPECTF--
44array(4) {
45  ["base"]=>
46  string(%d) "0x%x"
47  ["max_size"]=>
48  string(%d) "0x%x"
49  ["position"]=>
50  string(%d) "0x%x"
51  ["EG(stack_limit)"]=>
52  string(%d) "0x%x"
53}
54bool(true)
55