1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.5'

* PHP-8.5:
  Update NEWS
  opcache: Fix segfault in function JIT due to NAN to bool warning (#19947)
This commit is contained in:
Gina Peter Banyard
2025-09-24 16:50:46 +01:00
3 changed files with 13 additions and 12 deletions

View File

@@ -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));

View File

@@ -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

View File

@@ -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
@@ -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"
@@ -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)