xref: /PHP-8.2/ext/opcache/tests/jit/gh12527.phpt (revision 1c95e227)
1--TEST--
2GH-12527: Incorrect hash/packed inference
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--FILE--
7<?php
8function foo(array $a1) {
9    $a2 = [];
10    foreach ($a1 as $key => $val) {
11        if (!$val) {
12            $a2["bad"][] = $key;
13        } else {
14            $a2[0][] = $key;
15        }
16    }
17    foreach ($a2 as $key => $val) {
18    	var_dump($key);
19    }
20}
21foo([1, 2, 3]);
22foo([1, 2, 3]);
23foo([0, 0]);
24?>
25--EXPECT--
26int(0)
27int(0)
28string(3) "bad"
29