xref: /PHP-8.1/ext/opcache/tests/jit/bug80447.phpt (revision e9f783fc)
1--TEST--
2Bug #80447 (Strange out of memory error when running with JIT)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=1M
8opcache.protect_memory=1
9--EXTENSIONS--
10opcache
11--FILE--
12<?php
13function createTree($depth) {
14    if (!$depth) {
15        return [null, null];
16    }
17    $depth--;
18
19    return [
20        createTree($depth),
21        createTree($depth)
22    ];
23}
24
25function checkTree($treeNode) {
26    return 1
27        + ($treeNode[0][0] === null ? 1 : checkTree($treeNode[0]))
28        + ($treeNode[1][0] === null ? 1 : checkTree($treeNode[1]));
29}
30
31$tree = createTree(12);
32var_dump(checkTree($tree));
33--EXPECT--
34int(8191)
35