Skip to content

Commit cbb9ee8

Browse files
committed
Added test for PR #19458
Thanks to @DanielEScherzer
1 parent 7e01cf5 commit cbb9ee8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--TEST--
2+
JIT ASSIGN_OBJ: violation of dominance
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
class CacheItem {
11+
protected mixed $value = null;
12+
}
13+
14+
function test($value) {
15+
$test = Closure::bind(
16+
static function ($value) {
17+
$item = new CacheItem();
18+
if (\is_array($value) && \array_key_exists('value', $value)) {
19+
$item->value = $value['value'];
20+
}
21+
return $item;
22+
},
23+
null,
24+
CacheItem::class);
25+
return $test($value);
26+
}
27+
28+
$values = [['value'=>'str'], ['value'=>'str'], ['value'=>42]];
29+
$n = count($values);
30+
31+
for ($i = 0; $i < $n; $i++) {
32+
test($values[$i]);
33+
}
34+
?>
35+
OK
36+
--EXPECT--
37+
OK

0 commit comments

Comments
 (0)