Skip to content

Commit 2dc8c7b

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix ASSIGN_STATIC_PROP_REF type inference
2 parents c77c79a + 983a4fc commit 2dc8c7b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Zend/Optimizer/zend_inference.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,6 +2975,9 @@ static zend_always_inline int _zend_update_type_info(
29752975
}
29762976
break;
29772977
case ZEND_ASSIGN_STATIC_PROP_REF:
2978+
if (ssa_op->result_def >= 0) {
2979+
UPDATE_SSA_TYPE(MAY_BE_REF, ssa_op->result_def);
2980+
}
29782981
if ((opline+1)->op1_type == IS_CV) {
29792982
opline++;
29802983
ssa_op++;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
ASSIGN_STATIC_PROP_REF result should have live range
3+
--FILE--
4+
<?php
5+
class Test {
6+
public static $prop;
7+
}
8+
Test::$prop =& $v + UNDEF;
9+
?>
10+
--EXPECTF--
11+
Fatal error: Uncaught Error: Undefined constant "UNDEF" in %s:%d
12+
Stack trace:
13+
#0 {main}
14+
thrown in %s on line %d

0 commit comments

Comments
 (0)