[php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Ilija Tovilo | Date: | Fri, 25 Sep 2026 15:02:49 +0000 |
| Subject: | [php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141561@lists.php.net to get a copy of this message | ||
Author: Ilija Tovilo (iluuu1994)
Date: 2026-09-25T17:02:28+02:00
Commit: https://github.com/php/php-src/commit/44bfa0f58eff33ab5565f711c0061524ce33730c
Raw diff: https://github.com/php/php-src/commit/44bfa0f58eff33ab5565f711c0061524ce33730c.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Skip result type inference verification for simple get
Changed paths:
A Zend/tests/property_hooks/simple_get_result_type_inference_verification.phpt
M Zend/zend_verify_type_inference.h
Diff:
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 000000000000..214a568e297d
--- /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 0add01933495..6f4f8df43b01 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. */