File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -2055,6 +2055,14 @@ static uint32_t binary_op_result_type(
2055
2055
uint32_t tmp = 0 ;
2056
2056
uint32_t t1_type = (t1 & MAY_BE_ANY ) | (t1 & MAY_BE_UNDEF ? MAY_BE_NULL : 0 );
2057
2057
uint32_t t2_type = (t2 & MAY_BE_ANY ) | (t2 & MAY_BE_UNDEF ? MAY_BE_NULL : 0 );
2058
+
2059
+ /* Handle potentially overloaded operators.
2060
+ * This could be made more precise by checking the class type, if known. */
2061
+ if ((t1_type & MAY_BE_OBJECT ) || (t2_type & MAY_BE_OBJECT )) {
2062
+ /* This is somewhat GMP specific. */
2063
+ tmp |= MAY_BE_OBJECT | MAY_BE_FALSE | MAY_BE_RC1 ;
2064
+ }
2065
+
2058
2066
switch (opcode ) {
2059
2067
case ZEND_ADD :
2060
2068
if (t1_type == MAY_BE_LONG && t2_type == MAY_BE_LONG ) {
@@ -2109,7 +2117,7 @@ static uint32_t binary_op_result_type(
2109
2117
* handling */
2110
2118
break ;
2111
2119
case ZEND_MOD :
2112
- tmp = MAY_BE_LONG ;
2120
+ tmp | = MAY_BE_LONG ;
2113
2121
/* Division by zero results in an exception, so it doesn't need any special handling */
2114
2122
break ;
2115
2123
case ZEND_BW_OR :
@@ -2124,7 +2132,7 @@ static uint32_t binary_op_result_type(
2124
2132
break ;
2125
2133
case ZEND_SL :
2126
2134
case ZEND_SR :
2127
- tmp = MAY_BE_LONG ;
2135
+ tmp | = MAY_BE_LONG ;
2128
2136
break ;
2129
2137
case ZEND_CONCAT :
2130
2138
case ZEND_FAST_CONCAT :
@@ -2252,6 +2260,10 @@ static int zend_update_type_info(const zend_op_array *op_array,
2252
2260
if (t1 & (MAY_BE_ANY - MAY_BE_STRING )) {
2253
2261
tmp |= MAY_BE_LONG ;
2254
2262
}
2263
+ if (t1 & MAY_BE_OBJECT ) {
2264
+ /* Potentially overloaded operator. */
2265
+ tmp |= MAY_BE_OBJECT | MAY_BE_RC1 ;
2266
+ }
2255
2267
UPDATE_SSA_TYPE (tmp , ssa_ops [i ].result_def );
2256
2268
break ;
2257
2269
case ZEND_BEGIN_SILENCE :
You can’t perform that action at this time.
0 commit comments