Skip to content

Commit aa285a0

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix ASSIGN_STATIC_PROP_REF type inference
2 parents 59c3a7f + 2dc8c7b commit aa285a0

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
@@ -2997,6 +2997,9 @@ static zend_always_inline zend_result _zend_update_type_info(
29972997
}
29982998
break;
29992999
case ZEND_ASSIGN_STATIC_PROP_REF:
3000+
if (ssa_op->result_def >= 0) {
3001+
UPDATE_SSA_TYPE(MAY_BE_REF, ssa_op->result_def);
3002+
}
30003003
if ((opline+1)->op1_type == IS_CV) {
30013004
opline++;
30023005
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)