xref: /PHP-8.3/ext/opcache/tests/opt/gh10008.phpt (revision 798b9d09)
1--TEST--
2GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--EXTENSIONS--
7opcache
8--FILE--
9<?php
10function test()
11{
12    $bool_or_int = true;
13    while (a()) {
14        if ($bool_or_int !== true) {
15            // The following line triggers narrowing during type inference of ZEND_ADD_ARRAY_ELEMENT.
16            $string_key = "a";
17            $array = ["bool_or_int" => $bool_or_int, $string_key => 123];
18        }
19
20        $bool_or_int = 0;
21    }
22}
23?>
24DONE
25--EXPECT--
26DONE
27