php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81379 gmp_init() not accepting GMP values despite saying so
Submitted: 2021-08-24 11:37 UTC Modified: 2023-09-27 15:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: michelbach94 at gmail dot com Assigned: nielsdos (profile)
Status: Closed Package: GNU MP related
PHP Version: 8.0.9 OS: Manjaro
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: michelbach94 at gmail dot com
New email:
PHP Version: OS:

 

 [2021-08-24 11:37 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-24 12:10 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2021-08-24 12:10 UTC] 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 13:12 UTC] nikic@php.net
I'm okay with accepting GMP in gmp_init().
 [2023-09-27 15:00 UTC] nielsdos@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: nielsdos
 [2023-09-27 15:00 UTC] nielsdos@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php

Seems to have been fixed in 8.1.11 & 8.2.10
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 10:01:28 2024 UTC