[php-src] PHP-8.4: Added test for PR #19458
Author: Dmitry Stogov (dstogov)
Date: 2025-08-13T15:58:04+03:00
Commit: https://github.com/php/php-src/commit/cbb9ee8f5b1976c19fd0070f242cd8c798083bd5
Raw diff: https://github.com/php/php-src/commit/cbb9ee8f5b1976c19fd0070f242cd8c798083bd5.diff
Added test for PR #19458
Thanks to @DanielEScherzer
Changed paths:
A ext/opcache/tests/jit/assign_obj_006.phpt
Diff:
diff --git a/ext/opcache/tests/jit/assign_obj_006.phpt b/ext/opcache/tests/jit/assign_obj_006.phpt
new file mode 100644
index 0000000000000..a48299f040152
--- /dev/null
+++ b/ext/opcache/tests/jit/assign_obj_006.phpt
@@ -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
Thread (1 message)
- Dmitry Stogov