@@ -1085,6 +1085,9 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
1085
1085
&& (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_STRING )) {
1086
1086
return 0 ;
1087
1087
}
1088
+ if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1089
+ return 0 ;
1090
+ }
1088
1091
return 1 ;
1089
1092
} else if (opline -> opcode == ZEND_ASSIGN_OP
1090
1093
&& (opline -> extended_value == ZEND_ADD
@@ -1113,11 +1116,7 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
1113
1116
const zend_op * opline = ssa_opcodes [idx ];
1114
1117
if (opline -> opcode == ZEND_ADD
1115
1118
|| opline -> opcode == ZEND_SUB
1116
- || opline -> opcode == ZEND_MUL
1117
- || opline -> opcode == ZEND_PRE_DEC
1118
- || opline -> opcode == ZEND_PRE_INC
1119
- || opline -> opcode == ZEND_POST_DEC
1120
- || opline -> opcode == ZEND_POST_INC ) {
1119
+ || opline -> opcode == ZEND_MUL ) {
1121
1120
if ((opline -> op1_type & (IS_VAR |IS_CV ))
1122
1121
&& tssa -> ops [idx ].op1_use >= 0
1123
1122
&& (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_REF )) {
@@ -1128,6 +1127,34 @@ static int is_checked_guard(const zend_ssa *tssa, const zend_op **ssa_opcodes, u
1128
1127
&& (tssa -> var_info [tssa -> ops [idx ].op2_use ].type & MAY_BE_REF )) {
1129
1128
return 0 ;
1130
1129
}
1130
+ if (opline -> op1_type == IS_CONST ) {
1131
+ zval * zv = RT_CONSTANT (opline , opline -> op1 );
1132
+ if (Z_TYPE_P (zv ) != IS_LONG && Z_TYPE_P (zv ) != IS_DOUBLE ) {
1133
+ return 0 ;
1134
+ }
1135
+ } else if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1136
+ return 0 ;
1137
+ }
1138
+ if (opline -> op2_type == IS_CONST ) {
1139
+ zval * zv = RT_CONSTANT (opline , opline -> op2 );
1140
+ if (Z_TYPE_P (zv ) != IS_LONG && Z_TYPE_P (zv ) != IS_DOUBLE ) {
1141
+ return 0 ;
1142
+ }
1143
+ } else if (!(tssa -> var_info [tssa -> ops [idx ].op2_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1144
+ return 0 ;
1145
+ }
1146
+ } else if (opline -> opcode == ZEND_PRE_DEC
1147
+ || opline -> opcode == ZEND_PRE_INC
1148
+ || opline -> opcode == ZEND_POST_DEC
1149
+ || opline -> opcode == ZEND_POST_INC ) {
1150
+ if ((opline -> op1_type & (IS_VAR |IS_CV ))
1151
+ && tssa -> ops [idx ].op1_use >= 0
1152
+ && (tssa -> var_info [tssa -> ops [idx ].op1_use ].type & MAY_BE_REF )) {
1153
+ return 0 ;
1154
+ }
1155
+ if (!(tssa -> var_info [tssa -> ops [idx ].op1_use ].type & (MAY_BE_LONG |MAY_BE_DOUBLE ))) {
1156
+ return 0 ;
1157
+ }
1131
1158
return 1 ;
1132
1159
}
1133
1160
}
0 commit comments