Merge branch 'PHP-8.2'

* PHP-8.2:
  Unary minus const expression consistency
This commit is contained in:
Ilija Tovilo 2023-03-31 14:28:39 +02:00
commit ba33bbe260
No known key found for this signature in database
GPG Key ID: A4F5D403F118200A
2 changed files with 18 additions and 2 deletions

View File

@ -0,0 +1,16 @@
--TEST--
Unary minus constant expression consistency
--FILE--
<?php
const ZERO = 0.0;
const MINUS_ZERO = -ZERO;
$minus_zero = -ZERO;
var_dump(MINUS_ZERO);
var_dump($minus_zero);
?>
--EXPECT--
float(-0)
float(-0)

View File

@ -712,8 +712,8 @@ ZEND_API zend_result ZEND_FASTCALL zend_ast_evaluate_inner(
if (UNEXPECTED(zend_ast_evaluate_ex(&op2, ast->child[0], scope, &short_circuited, ctx) != SUCCESS)) {
ret = FAILURE;
} else {
ZVAL_LONG(&op1, 0);
ret = sub_function(result, &op1, &op2);
ZVAL_LONG(&op1, -1);
ret = mul_function(result, &op1, &op2);
zval_ptr_dtor_nogc(&op2);
}
break;