Skip to content

gmp throws the wrong error when a GMP object is passed to gmp_init #9308

Closed
@MagicalTux

Description

@MagicalTux

Description

Issue can be found in https://github.com/php/php-src/blob/master/ext/gmp/gmp.c#L624

The following code:

<?php
$x = gmp_init(gmp_init(123));

Resulted in this output:

PHP Warning:  Uncaught TypeError: gmp_init(): Argument #1 ($num) must be of type GMP|string|int, GMP given in php shell code:1

But I expected this output instead:

PHP Warning:  Uncaught TypeError: gmp_init(): Argument #1 ($num) must be of type string|int, GMP given in php shell code:1

PHP Version

8.1.6

Operating System

Gentoo

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions