xref: /PHP-8.4/ext/gmp/tests/gh9308.phpt (revision 293e6917)
1--TEST--
2Bug GH-9308: GMP throws the wrong error when a GMP object is passed to gmp_init()
3--EXTENSIONS--
4gmp
5--FILE--
6<?php
7declare(strict_types=1);
8
9/* We need strict_types as GMP has a __toString() handler */
10
11try {
12    $gmp = gmp_init(gmp_init(123));
13} catch (\TypeError $e) {
14    echo $e->getMessage(), \PHP_EOL;
15}
16
17?>
18--EXPECT--
19gmp_init(): Argument #1 ($num) must be of type string|int, GMP given
20