mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fixed incorrect type inference
This commit is contained in:
commit
574b0573ac
2 changed files with 60 additions and 1 deletions
|
@ -3455,7 +3455,9 @@ static zend_always_inline zend_result _zend_update_type_info(
|
||||||
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
|
UPDATE_SSA_TYPE(tmp, ssa_op->result_def);
|
||||||
break;
|
break;
|
||||||
case ZEND_FETCH_THIS:
|
case ZEND_FETCH_THIS:
|
||||||
UPDATE_SSA_OBJ_TYPE(op_array->scope, 1, ssa_op->result_def);
|
if (!(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
|
||||||
|
UPDATE_SSA_OBJ_TYPE(op_array->scope, 1, ssa_op->result_def);
|
||||||
|
}
|
||||||
UPDATE_SSA_TYPE(MAY_BE_RCN|MAY_BE_OBJECT, ssa_op->result_def);
|
UPDATE_SSA_TYPE(MAY_BE_RCN|MAY_BE_OBJECT, ssa_op->result_def);
|
||||||
break;
|
break;
|
||||||
case ZEND_FETCH_OBJ_R:
|
case ZEND_FETCH_OBJ_R:
|
||||||
|
|
57
ext/opcache/tests/jit/gh12482.phpt
Normal file
57
ext/opcache/tests/jit/gh12482.phpt
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
--TEST--
|
||||||
|
GH-12482: Invalid type inference
|
||||||
|
--INI--
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.jit_hot_func=2
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
trait T {
|
||||||
|
function foo() {
|
||||||
|
$cloned = clone $this;
|
||||||
|
$cloned->x = 42;
|
||||||
|
return $cloned;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class A {
|
||||||
|
use T;
|
||||||
|
public $a = 1;
|
||||||
|
public $b = 2;
|
||||||
|
public $c = 3;
|
||||||
|
public $x = 4;
|
||||||
|
}
|
||||||
|
class B {
|
||||||
|
use T;
|
||||||
|
public $x = 5;
|
||||||
|
}
|
||||||
|
$a = new A;
|
||||||
|
var_dump($a->foo());
|
||||||
|
var_dump($a->foo());
|
||||||
|
$b = new B;
|
||||||
|
var_dump($b->foo());
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
object(A)#2 (4) {
|
||||||
|
["a"]=>
|
||||||
|
int(1)
|
||||||
|
["b"]=>
|
||||||
|
int(2)
|
||||||
|
["c"]=>
|
||||||
|
int(3)
|
||||||
|
["x"]=>
|
||||||
|
int(42)
|
||||||
|
}
|
||||||
|
object(A)#2 (4) {
|
||||||
|
["a"]=>
|
||||||
|
int(1)
|
||||||
|
["b"]=>
|
||||||
|
int(2)
|
||||||
|
["c"]=>
|
||||||
|
int(3)
|
||||||
|
["x"]=>
|
||||||
|
int(42)
|
||||||
|
}
|
||||||
|
object(B)#3 (1) {
|
||||||
|
["x"]=>
|
||||||
|
int(42)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue