@@ -2788,31 +2788,21 @@ static zend_always_inline int _zend_update_type_info(
2788
2788
if (t1 & MAY_BE_STRING ) {
2789
2789
tmp |= MAY_BE_STRING ;
2790
2790
}
2791
- if (t1 & (( MAY_BE_ANY | MAY_BE_UNDEF ) - MAY_BE_STRING )) {
2791
+ if (t1 & (MAY_BE_ARRAY | MAY_BE_FALSE | MAY_BE_NULL | MAY_BE_UNDEF )) {
2792
2792
tmp |= (OP1_DATA_INFO () & (MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF ));
2793
2793
2794
2794
if (OP1_DATA_INFO () & MAY_BE_UNDEF ) {
2795
2795
tmp |= MAY_BE_NULL ;
2796
2796
}
2797
- if (opline -> op2_type == IS_UNUSED ) {
2798
- /* When appending to an array and the LONG_MAX key is already used
2799
- * null will be returned. */
2800
- tmp |= MAY_BE_NULL ;
2801
- }
2802
- if (t2 & (MAY_BE_ARRAY | MAY_BE_OBJECT )) {
2803
- /* Arrays and objects cannot be used as keys. */
2804
- tmp |= MAY_BE_NULL ;
2805
- }
2806
- if (t1 & (MAY_BE_ANY - (MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY ))) {
2807
- /* undef, null and false are implicitly converted to array, anything else
2808
- * results in a null return value. */
2809
- tmp |= MAY_BE_NULL ;
2797
+ if (t1 & MAY_BE_ARRAY_OF_REF ) {
2798
+ /* A scalar type conversion may occur when assigning to a typed reference. */
2799
+ tmp |= MAY_BE_NULL |MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_LONG |MAY_BE_DOUBLE |MAY_BE_STRING ;
2810
2800
}
2811
2801
}
2812
- tmp |= MAY_BE_RC1 | MAY_BE_RCN ;
2813
2802
if (t1 & MAY_BE_OBJECT ) {
2814
2803
tmp |= MAY_BE_REF ;
2815
2804
}
2805
+ tmp |= MAY_BE_RC1 | MAY_BE_RCN ;
2816
2806
UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
2817
2807
}
2818
2808
if ((ssa_op + 1 )-> op1_def >= 0 ) {
@@ -2917,9 +2907,9 @@ static zend_always_inline int _zend_update_type_info(
2917
2907
}
2918
2908
if (ssa_op -> result_def >= 0 ) {
2919
2909
if (tmp & MAY_BE_REF ) {
2920
- /* Assignment to typed reference may change type.
2921
- * Be conservative and don't assume anything. */
2922
- 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 ;
2910
+ /* A scalar type conversion may occur when assigning to a typed reference. */
2911
+ tmp &= ~ MAY_BE_REF ;
2912
+ 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 ;
2923
2913
}
2924
2914
UPDATE_SSA_TYPE (tmp , ssa_op -> result_def );
2925
2915
COPY_SSA_OBJ_TYPE (ssa_op -> op2_use , ssa_op -> result_def );
0 commit comments