xref: /PHP-8.0/ext/gmp/tests/bug81119.phpt (revision 08777387)
1--TEST--
2GMP operators throw errors with wrong parameter names
3--FILE--
4<?php
5
6function test($f) {
7    try {
8        $f();
9        echo "No error?\n";
10    } catch (TypeError|ValueError $e) {
11        echo $e->getMessage(), "\n";
12    }
13}
14test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) < "x");
15test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) < []);
16test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) + "x");
17test(fn($WRONG_SCOPE_1 = 0, $WRONG_SCOPE_2 = 0) => gmp_init(1) + []);
18
19?>
20--EXPECT--
21Number is not an integer string
22Number must be of type GMP|string|int, array given
23Number is not an integer string
24Number must be of type GMP|string|int, array given
25