Bug #81379 [Ver]: gmp_init() not accepting GMP values despite saying so
| From: | nikic@php.net | Date: | Tue, 24 Aug 2021 13:12:30 +0000 |
| Subject: | Bug #81379 [Ver]: gmp_init() not accepting GMP values despite saying so | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236038@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81379&edit=1
ID: 81379
Updated by: nikic@php.net
Reported by: michelbach94 at gmail dot com
Summary: gmp_init() not accepting GMP values despite saying
so
Status: Verified
Type: Bug
Package: GNU MP related
Operating System: Manjaro
PHP Version: 8.0.9
Block user comment: N
Private report: N
New Comment:
I'm okay with accepting GMP in gmp_init().
Previous Comments:
------------------------------------------------------------------------
[2021-08-24 12:10:01] cmb@php.net
Indeed. The problem is that convert_to_gmp() is used to convert
the arguments of several GMP functions, and all of them but
gmp_init() actually accept GMP instances. Maybe just accept GMP
instances for gmp_init() as well?
------------------------------------------------------------------------
[2021-08-24 11:37:10] michelbach94 at gmail dot com
Description:
------------
gmp_init() is documented to only accept strings and ints. However, its error message says that it
also accepts GMP objects while simultaneously saying it does not.
Test script:
---------------
php > gmp_init(gmp_init(5));
PHP Warning: Uncaught TypeError: gmp_init(): Argument #1 ($num) must be of type GMP|string|int, GMP
given in php shell code:1
Stack trace:
#0 php shell code(1): gmp_init(Object(GMP))
#1 {main}
thrown in php shell code on line 1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81379&edit=1