summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2017-07-22 21:23:17 -0400
committerSara Golemon <pollita@php.net>2017-07-22 21:23:17 -0400
commit1229b0f8cb483845e20d6687068a8c5edb79f5af (patch)
tree8648a3340f767d3c229fa3cca2e82c67d033f4fa /Zend
parentc068818ff33b20a233b0e847f7787459a541249d (diff)
parentc562d44321ea69612fbe3f7460055e9ed4340baa (diff)
downloadphp-git-1229b0f8cb483845e20d6687068a8c5edb79f5af.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fix compile-time optimization of NAN comparisons
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_operators.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 418d2f03ea..7d53704da3 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -2166,6 +2166,16 @@ ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *
ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
+ if (UNEXPECTED((Z_TYPE_P(op1) == IS_DOUBLE) && isnan(Z_DVAL_P(op1)))) {
+ ZVAL_FALSE(result);
+ return SUCCESS;
+ }
+
+ if (UNEXPECTED((Z_TYPE_P(op2) == IS_DOUBLE) && isnan(Z_DVAL_P(op2)))) {
+ ZVAL_FALSE(result);
+ return SUCCESS;
+ }
+
if (compare_function(result, op1, op2) == FAILURE) {
return FAILURE;
}
@@ -2176,6 +2186,16 @@ ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op
ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */
{
+ if (UNEXPECTED((Z_TYPE_P(op1) == IS_DOUBLE) && isnan(Z_DVAL_P(op1)))) {
+ ZVAL_FALSE(result);
+ return SUCCESS;
+ }
+
+ if (UNEXPECTED((Z_TYPE_P(op2) == IS_DOUBLE) && isnan(Z_DVAL_P(op2)))) {
+ ZVAL_FALSE(result);
+ return SUCCESS;
+ }
+
if (compare_function(result, op1, op2) == FAILURE) {
return FAILURE;
}