1--TEST-- 2Bug GH-9308: GMP throws the wrong error when a GMP object is passed to gmp_init() 3--SKIPIF-- 4<?php extension_loaded('gmp') or die('skip gmp extension is not available'); ?> 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