1--TEST--
2GMP operator overloading does not support stringable objects
3--EXTENSIONS--
4gmp
5--FILE--
6<?php
7
8class T {
9    public function __toString() {
10        return "42";
11    }
12}
13
14$num = gmp_init(42);
15$o = new T();
16
17try {
18    var_dump($num + $o);
19} catch (Throwable $e) {
20    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
21}
22
23try {
24    var_dump($num - $o);
25} catch (Throwable $e) {
26    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
27}
28
29try {
30    var_dump($num * $o);
31} catch (Throwable $e) {
32    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
33}
34
35try {
36    var_dump($num / $o);
37} catch (Throwable $e) {
38    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
39}
40
41try {
42    var_dump($num % $o);
43} catch (Throwable $e) {
44    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
45}
46
47try {
48    var_dump($num ** $o);
49} catch (Throwable $e) {
50    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
51}
52
53try {
54    var_dump($num | $o);
55} catch (Throwable $e) {
56    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
57}
58try {
59    var_dump($num & $o);
60} catch (Throwable $e) {
61    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
62}
63try {
64    var_dump($num ^ $o);
65} catch (Throwable $e) {
66    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
67}
68try {
69    var_dump($num << $o);
70} catch (Throwable $e) {
71    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
72}
73try {
74    var_dump($num >> $o);
75} catch (Throwable $e) {
76    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
77}
78
79?>
80--EXPECTF--
81TypeError: Number must be of type GMP|string|int, T given
82TypeError: Number must be of type GMP|string|int, T given
83TypeError: Number must be of type GMP|string|int, T given
84TypeError: Number must be of type GMP|string|int, T given
85TypeError: Number must be of type GMP|string|int, T given
86TypeError: Unsupported operand types: GMP ** T
87TypeError: Number must be of type GMP|string|int, T given
88TypeError: Number must be of type GMP|string|int, T given
89TypeError: Number must be of type GMP|string|int, T given
90TypeError: Unsupported operand types: GMP << T
91TypeError: Unsupported operand types: GMP >> T
92