1--TEST--
2gmp_init() with various integer notations and leading spaces
3--EXTENSIONS--
4gmp
5--FILE--
6<?php
7
8var_dump(gmp_init("  0x16"));
9var_dump(gmp_init("  0X16"));
10var_dump(gmp_init("  0o16"));
11var_dump(gmp_init("  0o16"));
12var_dump(gmp_init("  016"));
13var_dump(gmp_init("  016"));
14var_dump(gmp_init("  0b11"));
15var_dump(gmp_init("  0b11"));
16var_dump(gmp_init("  0"));
17try {
18    var_dump(gmp_init("  "));
19} catch (\Throwable $e) {
20    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
21}
22
23?>
24--EXPECT--
25object(GMP)#1 (1) {
26  ["num"]=>
27  string(2) "22"
28}
29object(GMP)#1 (1) {
30  ["num"]=>
31  string(2) "22"
32}
33object(GMP)#1 (1) {
34  ["num"]=>
35  string(2) "14"
36}
37object(GMP)#1 (1) {
38  ["num"]=>
39  string(2) "14"
40}
41object(GMP)#1 (1) {
42  ["num"]=>
43  string(2) "14"
44}
45object(GMP)#1 (1) {
46  ["num"]=>
47  string(2) "14"
48}
49object(GMP)#1 (1) {
50  ["num"]=>
51  string(1) "3"
52}
53object(GMP)#1 (1) {
54  ["num"]=>
55  string(1) "3"
56}
57object(GMP)#1 (1) {
58  ["num"]=>
59  string(1) "0"
60}
61ValueError: gmp_init(): Argument #1 ($num) is not an integer string
62