Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -7742,7 +7742,8 @@ static int zend_jit_bool_jmpznz(zend_jit_ctx *jit, const zend_op *opline, uint32
ir_ref is_nan = ir_NE(dval, dval);
ir_ref if_val = ir_IF(is_nan);
ir_IF_TRUE_cold(if_val);
ir_CALL(IR_VOID, ir_CONST_FC_FUNC(zend_jit_nan_coerced_to_type_warning));
jit_SET_EX_OPLINE(jit, opline);
ir_CALL(IR_VOID, ir_CONST_FC_FUNC(zend_jit_nan_coerced_to_type_warning));
ir_MERGE_WITH_EMPTY_FALSE(if_val);

ref = ir_NE(dval, ir_CONST_DOUBLE(0.0));
Expand Down
6 changes: 3 additions & 3 deletions ext/opcache/tests/jit/nan_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ for ($i = 0; $i < 3; $i++) {
}
?>
--EXPECTF--
Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 4
nan is true

Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 4
nan is true

Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 4
nan is true
16 changes: 8 additions & 8 deletions ext/opcache/tests/jit/nan_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ opcache.protect_memory=1
<?php
function test(float $a) {
if ($a) var_dump("1");
if (!$a) var_dump("2");
if (!$a) var_dump("2");
var_dump((bool) $a);
var_dump(!$a);
echo "\n";
}
function test1(float $a, bool $b) {
var_dump($a && $b); //JMPNZ_EX
var_dump($a && $b); //JMPNZ_EX
}
function test2(float $a, bool $b) {
var_dump($a || $b); // JMPZ_EX
Expand All @@ -34,15 +34,15 @@ test2(1.0, false);
test2(0.0, false);
?>
--EXPECTF--
Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 3
string(1) "1"

Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 4

Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 5
bool(true)

Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 6
bool(false)

string(1) "1"
Expand All @@ -54,13 +54,13 @@ bool(false)
bool(true)


Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 10
bool(true)
bool(true)
bool(false)


Warning: unexpected NAN value was coerced to bool in %s on line %d
Warning: unexpected NAN value was coerced to bool in %s on line 13
bool(true)
bool(true)
bool(false)