1--TEST--
2BcMath\Number powmod arg error
3--EXTENSIONS--
4bcmath
5--FILE--
6<?php
7$args = [
8    ['a', 'non number str'],
9    [[], 'array'],
10    [new stdClass(), 'other object'],
11    [0.1, 'float'],
12    [null, 'null'],
13];
14
15$num = new BcMath\Number('100.0000');
16
17echo "========== check 1st arg ==========\n";
18foreach ($args as [$val, $type]) {
19    echo "{$type}:\n";
20    try {
21        $num->powmod($val, 1);
22    } catch (Error $e) {
23        echo $e->getMessage() . "\n";
24    }
25}
26
27echo "\n";
28
29echo "========== check 2nd arg ==========\n";
30foreach ($args as [$val, $type]) {
31    echo "{$type}:\n";
32    try {
33        $num->powmod(1, $val);
34    } catch (Error $e) {
35        echo $e->getMessage() . "\n";
36    }
37}
38?>
39--EXPECTF--
40========== check 1st arg ==========
41non number str:
42BcMath\Number::powmod(): Argument #1 ($exponent) is not well-formed
43array:
44BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, array given
45other object:
46BcMath\Number::powmod(): Argument #1 ($exponent) must be of type int, string, or BcMath\Number, stdClass given
47float:
48
49Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
50null:
51
52Deprecated: BcMath\Number::powmod(): Passing null to parameter #1 ($exponent) of type BcMath\Number|string|int is deprecated in %s
53
54========== check 2nd arg ==========
55non number str:
56BcMath\Number::powmod(): Argument #2 ($modulus) is not well-formed
57array:
58BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, array given
59other object:
60BcMath\Number::powmod(): Argument #2 ($modulus) must be of type int, string, or BcMath\Number, stdClass given
61float:
62
63Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
64Modulo by zero
65null:
66
67Deprecated: BcMath\Number::powmod(): Passing null to parameter #2 ($modulus) of type BcMath\Number|string|int is deprecated in %s
68Modulo by zero
69