xref: /php-src/ext/opcache/tests/jit/gh12512.phpt (revision 93d5c0e9)
1--TEST--
2GH-12512: missing type store
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--FILE--
7<?php
8function bar(array &$a): ?bool {
9    $ret = null;
10    foreach ($a as $key => $val) {
11        if ($val === 2) {
12            unset($a[$key]);
13        }
14    }
15    return $ret;
16}
17
18function foo($a, bool $b): bool {
19    if ($b) return true;
20    $n2 = count($a);
21    do {
22        $n = $n2;
23        $res = bar($a);
24        $n2 = count($a);
25    } while ($res === null && $n !== $n2);
26
27    if ($res === null && $n === 0) {
28        return false;
29    }
30    return true;
31}
32
33$a = [1,'a'=>5];
34bar($a);
35foo([1,'a'=>5], true);
36foo([1,'a'=>5], false);
37foo([2,'a'=>5], false);
38?>
39DONE
40--EXPECT--
41DONE
42