Skip to content

Commit 1de8497

Browse files
committed
init
1 parent 5bd7e3b commit 1de8497

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.4.22
44

5+
- GMP:
6+
. GMP exponentiation and shift operators now emit a deprecation warning
7+
when converting a float right operand to int loses precision. (Weilin Du)
8+
59
- Opcache:
610
. Fixed tracing JIT crash when a VM interrupt is handled during an observed
711
user function call. (Levi Morrison)

UPGRADING

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,11 @@ PHP 8.4 UPGRADE NOTES
522522
deprecated. Use either IntlGregorianCalendar::createFromDate() or
523523
IntlGregorianCalendar::createFromDateTime() instead.
524524

525+
- GMP:
526+
. The shift (<<, >>) and exponentiation (**) operators on GMP objects now
527+
emit a deprecation warning when converting a float right operand to int
528+
loses precision.
529+
525530
- LDAP:
526531
. Calling ldap_connect() with more than 2 arguments is deprecated. Use
527532
ldap_connect_wallet() instead.

ext/gmp/gmp.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,15 @@ static zend_result shift_operator_helper(gmp_binary_ui_op_t op, zval *return_val
347347

348348
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
349349
if (UNEXPECTED(!IS_GMP(op2))) {
350-
// For PHP 8.3 and up use zend_try_get_long()
351350
switch (Z_TYPE_P(op2)) {
352-
case IS_DOUBLE:
353-
shift = zval_get_long(op2);
354-
if (UNEXPECTED(EG(exception))) {
351+
case IS_DOUBLE: {
352+
bool failed;
353+
shift = zval_try_get_long(op2, &failed);
354+
if (UNEXPECTED(failed)) {
355355
return FAILURE;
356356
}
357357
break;
358+
}
358359
case IS_STRING:
359360
if (is_numeric_str_function(Z_STR_P(op2), &shift, NULL) != IS_LONG) {
360361
goto valueof_op_failure;

ext/gmp/tests/overloading_with_float_fractional.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ object(GMP)#2 (1) {
100100
["num"]=>
101101
string(1) "0"
102102
}
103+
104+
Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
103105
object(GMP)#2 (1) {
104106
["num"]=>
105107
string(69) "150130937545296572356771972164254457814047970568738777235893533016064"
@@ -122,10 +124,14 @@ object(GMP)#2 (1) {
122124
["num"]=>
123125
string(1) "0"
124126
}
127+
128+
Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
125129
object(GMP)#2 (1) {
126130
["num"]=>
127131
string(15) "184717953466368"
128132
}
133+
134+
Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
129135
object(GMP)#2 (1) {
130136
["num"]=>
131137
string(1) "0"

0 commit comments

Comments
 (0)