[php-src] Issue #9308: gmp throws the wrong error when a GMP object is passed to gmp_init
| From: | MagicalTux | Date: | Fri, 12 Aug 2022 07:13:25 +0000 |
| Subject: | [php-src] Issue #9308: gmp throws the wrong error when a GMP object is passed to gmp_init | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242189@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9308
Author: MagicalTux
### Description
Issue can be found in https://github.com/php/php-src/blob/master/ext/gmp/gmp.c#L624
The following code:
```php
<?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