-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-9308 GMP throws the wrong error when a GMP object is passed to…
… gmp_init() Closes GH-9490
- Loading branch information
Showing
3 changed files
with
66 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
Bug GH-9308: GMP throws the wrong error when a GMP object is passed to gmp_init() | ||
--SKIPIF-- | ||
<?php extension_loaded('gmp') or die('skip gmp extension is not available'); ?> | ||
--FILE-- | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/* We need strict_types as GMP has a __toString() handler */ | ||
|
||
try { | ||
$gmp = gmp_init(gmp_init(123)); | ||
} catch (\TypeError $e) { | ||
echo $e->getMessage(), \PHP_EOL; | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
gmp_init(): Argument #1 ($num) must be of type string|int, GMP given |