Skip to content
Open
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
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.4.22

- GMP:
. GMP exponentiation and shift operators now emit a deprecation warning
when converting a float right operand to int loses precision. (Weilin Du)

- Opcache:
. Fixed tracing JIT crash when a VM interrupt is handled during an observed
user function call. (Levi Morrison)
Expand Down
4 changes: 4 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ PHP 8.4 UPGRADE NOTES
. Gettext:
. bind_textdomain_codeset, textdomain and d(*)gettext functions now throw an exception
if the domain argument is empty.
. GMP:
. The shift (<<, >>) and exponentiation (**) operators on GMP objects now
emit a deprecation warning when converting a float right operand to int
loses precision.
. Intl:
. resourcebundle_get(), ResourceBundle::get(), and accessing offsets on a
ResourceBundle object now throw:
Expand Down
6 changes: 3 additions & 3 deletions ext/gmp/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,11 @@ static zend_result shift_operator_helper(gmp_binary_ui_op_t op, zval *return_val

if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
if (UNEXPECTED(!IS_GMP(op2))) {
// For PHP 8.3 and up use zend_try_get_long()
bool failed;
switch (Z_TYPE_P(op2)) {
case IS_DOUBLE:
shift = zval_get_long(op2);
if (UNEXPECTED(EG(exception))) {
shift = zval_try_get_long(op2, &failed);
if (UNEXPECTED(failed)) {
return FAILURE;
}
break;
Expand Down
6 changes: 6 additions & 0 deletions ext/gmp/tests/overloading_with_float_fractional.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ object(GMP)#2 (1) {
["num"]=>
string(1) "0"
}

Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
object(GMP)#2 (1) {
["num"]=>
string(69) "150130937545296572356771972164254457814047970568738777235893533016064"
Expand All @@ -122,10 +124,14 @@ object(GMP)#2 (1) {
["num"]=>
string(1) "0"
}

Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
object(GMP)#2 (1) {
["num"]=>
string(15) "184717953466368"
}

Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
object(GMP)#2 (1) {
["num"]=>
string(1) "0"
Expand Down
Loading