Skip to content

Commit 906cb52

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fixed NAN handling in SCCP
2 parents c958ab1 + 698ac23 commit 906cb52

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

Zend/Optimizer/sccp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) {
182182
}
183183

184184
#if ZEND_DEBUG
185-
ZEND_ASSERT(zend_is_identical(value, new));
185+
ZEND_ASSERT(zend_is_identical(value, new) ||
186+
(Z_TYPE_P(value) == IS_DOUBLE && Z_TYPE_P(new) == IS_DOUBLE && isnan(Z_DVAL_P(value)) && isnan(Z_DVAL_P(new))));
186187
#endif
187188
}
188189

ext/opcache/tests/opt/sccp_036.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
SCCP 036: NAN handling
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
function foo() {
10+
$y=NAN;
11+
for(;x;)for(;$y=1;);
12+
}
13+
?>
14+
DONE
15+
--EXPECT--
16+
DONE

0 commit comments

Comments
 (0)