Skip to content

Commit de07248

Browse files
committed
Add a regression test for GH-10008
1 parent 38d50a9 commit de07248

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

ext/opcache/tests/opt/gh10008.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
GH-10008 (Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=0x20
7+
--EXTENSIONS--
8+
opcache
9+
--FILE--
10+
<?php
11+
function test()
12+
{
13+
$bool_or_int = true;
14+
while (a()) {
15+
if ($bool_or_int !== true) {
16+
// The following line (no longer) triggers narrowing during type inference of ZEND_ADD_ARRAY_ELEMENT.
17+
$string_key = "a";
18+
$array = ["bool_or_int" => $bool_or_int, $string_key => 123];
19+
}
20+
21+
$bool_or_int = 0;
22+
}
23+
}
24+
?>
25+
OK
26+
--EXPECT--
27+
OK

0 commit comments

Comments
 (0)