Skip to content

Commit 1640beb

Browse files
committed
Explicitly accept a comparison between NAN and true
1 parent e387df7 commit 1640beb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Zend/zend_operators.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2405,7 +2405,11 @@ ZEND_API int ZEND_FASTCALL zend_compare(zval *op1, zval *op2) /* {{{ */
24052405
(Z_TYPE_P(op1) == IS_DOUBLE && zend_isnan(Z_DVAL_P(op1)))
24062406
|| (Z_TYPE_P(op2) == IS_DOUBLE && zend_isnan(Z_DVAL_P(op2)))
24072407
) {
2408-
return 1;
2408+
/* Fallback when explicitly comparing against true */
2409+
if (UNEXPECTED(Z_TYPE_P(op1) == IS_TRUE || Z_TYPE_P(op2) == IS_TRUE)) {
2410+
return 0;
2411+
}
2412+
return ZEND_UNCOMPARABLE;
24092413
}
24102414
if (Z_TYPE_P(op1) < IS_TRUE) {
24112415
return zval_is_true(op2) ? -1 : 0;

0 commit comments

Comments
 (0)