summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_operators.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 2081338a01..71663ae31c 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -2129,15 +2129,15 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
}
}
if (!converted) {
- if (Z_TYPE_P(op1) == IS_NULL || Z_TYPE_P(op1) == IS_FALSE) {
+ if (Z_TYPE_P(op1) < IS_TRUE) {
ZVAL_LONG(result, zval_is_true(op2) ? -1 : 0);
return SUCCESS;
- } else if (Z_TYPE_P(op2) == IS_NULL || Z_TYPE_P(op2) == IS_FALSE) {
- ZVAL_LONG(result, zval_is_true(op1) ? 1 : 0);
- return SUCCESS;
} else if (Z_TYPE_P(op1) == IS_TRUE) {
ZVAL_LONG(result, zval_is_true(op2) ? 0 : 1);
return SUCCESS;
+ } else if (Z_TYPE_P(op2) < IS_TRUE) {
+ ZVAL_LONG(result, zval_is_true(op1) ? 1 : 0);
+ return SUCCESS;
} else if (Z_TYPE_P(op2) == IS_TRUE) {
ZVAL_LONG(result, zval_is_true(op1) ? 0 : -1);
return SUCCESS;
@@ -2158,14 +2158,12 @@ ZEND_API int ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
} else if (Z_TYPE_P(op2)==IS_ARRAY) {
ZVAL_LONG(result, -1);
return SUCCESS;
- } else if (Z_TYPE_P(op1)==IS_OBJECT) {
- ZVAL_LONG(result, 1);
- return SUCCESS;
- } else if (Z_TYPE_P(op2)==IS_OBJECT) {
- ZVAL_LONG(result, -1);
- return SUCCESS;
} else {
- ZVAL_LONG(result, 0);
+ ZEND_ASSERT(0);
+ zend_throw_error(NULL, "Unsupported operand types");
+ if (result != op1) {
+ ZVAL_UNDEF(result);
+ }
return FAILURE;
}
}