1--TEST--
2Stack limit 012 - Stack limit exhaustion during unwinding
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--INI--
10zend.max_allowed_stack_size=256K
11--FILE--
12<?php
13
14var_dump(zend_test_zend_call_stack_get());
15
16function replace() {
17    return preg_replace_callback('#.#', function () {
18        try {
19            replace();
20        } finally {
21            require __DIR__ . '/stack_limit_012.inc';
22        }
23    }, 'x');
24}
25
26replace();
27
28?>
29--EXPECTF--
30array(4) {
31  ["base"]=>
32  string(%d) "0x%x"
33  ["max_size"]=>
34  string(%d) "0x%x"
35  ["position"]=>
36  string(%d) "0x%x"
37  ["EG(stack_limit)"]=>
38  string(%d) "0x%x"
39}
40
41Fatal error: Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached during compilation. Try splitting expression in %s on line %d
42