1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Added test for PR #19458

Thanks to @DanielEScherzer
This commit is contained in:
Dmitry Stogov
2025-08-13 15:58:04 +03:00
parent 7e01cf59bb
commit cbb9ee8f5b

View File

@@ -0,0 +1,37 @@
--TEST--
JIT ASSIGN_OBJ: violation of dominance
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
class CacheItem {
protected mixed $value = null;
}
function test($value) {
$test = Closure::bind(
static function ($value) {
$item = new CacheItem();
if (\is_array($value) && \array_key_exists('value', $value)) {
$item->value = $value['value'];
}
return $item;
},
null,
CacheItem::class);
return $test($value);
}
$values = [['value'=>'str'], ['value'=>'str'], ['value'=>42]];
$n = count($values);
for ($i = 0; $i < $n; $i++) {
test($values[$i]);
}
?>
OK
--EXPECT--
OK