Skip to content

Commit 4d907a6

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fixed NAN handling in SCCP
2 parents 1b7d50b + 906cb52 commit 4d907a6

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
@@ -181,7 +181,8 @@ static void set_value(scdf_ctx *scdf, sccp_ctx *ctx, int var, zval *new) {
181181
}
182182

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

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)