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