Skip to content

Commit e77d738

Browse files
committed
[skip ci] Revert "init" (I push it to the wrong branch)
This reverts commit 7474936.
1 parent 7474936 commit e77d738

4 files changed

Lines changed: 4 additions & 18 deletions

File tree

NEWS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ PHP NEWS
5151
. gmp_fact() reject values larger than unsigned long. (David Carlier)
5252
. gmp_pow/binomial/root/rootrem and shift/pow operators reject values
5353
larger than unsigned long. (David Carlier)
54-
. GMP exponentiation and shift operators now emit a deprecation warning
55-
when converting a float right operand to int loses precision. (Weilin Du)
5654

5755
- Hash:
5856
. Upgrade xxHash to 0.8.2. (timwolla)

UPGRADING

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ PHP 8.6 UPGRADE NOTES
166166
is no longer maintained.
167167
RFC: https://wiki.php.net/rfc/eol-oniguruma
168168

169-
- GMP:
170-
. The shift (<<, >>) and exponentiation (**) operators on GMP objects now
171-
emit a deprecation warning when converting a float right operand to int
172-
loses precision.
173-
174169
========================================
175170
5. Changed Functions
176171
========================================

ext/gmp/gmp.c

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

333333
if (UNEXPECTED(Z_TYPE_P(op2) != IS_LONG)) {
334334
if (UNEXPECTED(!IS_GMP(op2))) {
335+
// For PHP 8.3 and up use zend_try_get_long()
335336
switch (Z_TYPE_P(op2)) {
336-
case IS_DOUBLE: {
337-
bool failed;
338-
shift = zval_try_get_long(op2, &failed);
339-
if (UNEXPECTED(failed)) {
337+
case IS_DOUBLE:
338+
shift = zval_get_long(op2);
339+
if (UNEXPECTED(EG(exception))) {
340340
return FAILURE;
341341
}
342342
break;
343-
}
344343
case IS_STRING:
345344
if (is_numeric_str_function(Z_STR_P(op2), &shift, NULL) != IS_LONG) {
346345
goto valueof_op_failure;

ext/gmp/tests/overloading_with_float_fractional.phpt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ 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
105103
object(GMP)#2 (1) {
106104
["num"]=>
107105
string(69) "150130937545296572356771972164254457814047970568738777235893533016064"
@@ -124,14 +122,10 @@ object(GMP)#2 (1) {
124122
["num"]=>
125123
string(1) "0"
126124
}
127-
128-
Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
129125
object(GMP)#2 (1) {
130126
["num"]=>
131127
string(15) "184717953466368"
132128
}
133-
134-
Deprecated: Implicit conversion from float 42.5 to int loses precision in %s on line %d
135129
object(GMP)#2 (1) {
136130
["num"]=>
137131
string(1) "0"

0 commit comments

Comments
 (0)