Commit 34014830834 for php
commit 340148308347f2e010d3d6cf810187d63f6eea92
Author: Ilija Tovilo <ilija.tovilo@me.com>
Date: Fri Sep 25 16:58:21 2026 +0200
Skip result type inference verification for simple get
Simple get uses VM recursion rather than C stack recursion, which means the
result is not actually written when the handler ends. Skip verification when we
detect a switch to a different stack frame.
diff --git a/Zend/tests/property_hooks/simple_get_result_type_inference_verification.phpt b/Zend/tests/property_hooks/simple_get_result_type_inference_verification.phpt
new file mode 100644
index 00000000000..214a568e297
--- /dev/null
+++ b/Zend/tests/property_hooks/simple_get_result_type_inference_verification.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Result type inference verification for simple get is skipped
+--FILE--
+<?php
+
+class Foo {
+ private array $backing = [];
+
+ public array $prop {
+ get => $this->backing;
+ }
+
+ public function test(): void {
+ $prop = $this->prop;
+ }
+}
+
+$foo = new Foo;
+$foo->test();
+$foo->test();
+echo "Done\n";
+
+?>
+--EXPECT--
+Done
diff --git a/Zend/zend_verify_type_inference.h b/Zend/zend_verify_type_inference.h
index 0add0193349..6f4f8df43b0 100644
--- a/Zend/zend_verify_type_inference.h
+++ b/Zend/zend_verify_type_inference.h
@@ -187,7 +187,8 @@ static void zend_verify_inference_def(zend_execute_data *execute_data, const zen
&& opline->opcode != ZEND_DO_FCALL_BY_NAME
/* ZEND_FE_FETCH_R[W] does not define a result in the last iteration. */
&& opline->opcode != ZEND_FE_FETCH_R
- && opline->opcode != ZEND_FE_FETCH_RW) {
+ && opline->opcode != ZEND_FE_FETCH_RW
+ && (opline->opcode != ZEND_FETCH_OBJ_R || EG(current_execute_data) == execute_data)) {
zend_verify_type_inference(EX_VAR(opline->result.var), opline->result_def_type, opline->result_type, execute_data, opline, "result_def");
/* Verify return value in the context of caller. */