File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,16 @@ function test() {
11
11
$ ref =& $ obj ->prop ;
12
12
var_dump ($ ref = 0 );
13
13
}
14
+ function test2 () {
15
+ $ obj = new Test ;
16
+ $ ary = [];
17
+ $ ary [0 ] =& $ obj ->prop ;
18
+ var_dump ($ ary [0 ] = 0 );
19
+ }
14
20
test ();
21
+ test2 ();
15
22
16
23
?>
17
24
--EXPECT--
18
25
string(1) "0"
26
+ string(1) "0"
Original file line number Diff line number Diff line change @@ -2757,6 +2757,10 @@ static zend_always_inline int _zend_update_type_info(
2757
2757
if (OP1_DATA_INFO () & MAY_BE_UNDEF ) {
2758
2758
tmp |= MAY_BE_NULL ;
2759
2759
}
2760
+ if (t1 & MAY_BE_ARRAY_OF_REF ) {
2761
+ /* A scalar type conversion may occur when assigning to a typed reference. */
2762
+ tmp |= MAY_BE_NULL |MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_LONG |MAY_BE_DOUBLE |MAY_BE_STRING ;
2763
+ }
2760
2764
}
2761
2765
if (t1 & MAY_BE_OBJECT ) {
2762
2766
tmp |= MAY_BE_REF ;
@@ -2866,9 +2870,9 @@ static zend_always_inline int _zend_update_type_info(
2866
2870
}
2867
2871
if (ssa_op -> result_def >= 0 ) {
2868
2872
if (tmp & MAY_BE_REF ) {
2869
- /* Assignment to typed reference may change type.
2870
- * Be conservative and don't assume anything. */
2871
- tmp = MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ;
2873
+ /* A scalar type conversion may occur when assigning to a typed reference. */
2874
+ tmp &= ~ MAY_BE_REF ;
2875
+ tmp |= MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_LONG | MAY_BE_DOUBLE | MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN ;
2872
2876
}
2873
2877
UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
2874
2878
COPY_SSA_OBJ_TYPE (ssa_op -> op2_use , ssa_op -> result_def );
You can’t perform that action at this time.
0 commit comments