1--TEST-- 2GMP operator overloading does support int strings 3--EXTENSIONS-- 4gmp 5--FILE-- 6<?php 7 8$num = gmp_init(42); 9 10try { 11 var_dump($num + "2"); 12} catch (Throwable $e) { 13 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 14} 15 16try { 17 var_dump($num - "2"); 18} catch (Throwable $e) { 19 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 20} 21 22try { 23 var_dump($num * "2"); 24} catch (Throwable $e) { 25 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 26} 27 28try { 29 var_dump($num / "2"); 30} catch (Throwable $e) { 31 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 32} 33 34try { 35 var_dump($num % "2"); 36} catch (Throwable $e) { 37 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 38} 39 40try { 41 var_dump($num ** "2"); 42} catch (Throwable $e) { 43 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 44} 45 46try { 47 var_dump($num | "2"); 48} catch (Throwable $e) { 49 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 50} 51try { 52 var_dump($num & "2"); 53} catch (Throwable $e) { 54 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 55} 56try { 57 var_dump($num ^ "2"); 58} catch (Throwable $e) { 59 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 60} 61try { 62 var_dump($num << "2"); 63} catch (Throwable $e) { 64 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 65} 66try { 67 var_dump($num >> "2"); 68} catch (Throwable $e) { 69 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 70} 71 72?> 73--EXPECT-- 74object(GMP)#2 (1) { 75 ["num"]=> 76 string(2) "44" 77} 78object(GMP)#2 (1) { 79 ["num"]=> 80 string(2) "40" 81} 82object(GMP)#2 (1) { 83 ["num"]=> 84 string(2) "84" 85} 86object(GMP)#2 (1) { 87 ["num"]=> 88 string(2) "21" 89} 90object(GMP)#2 (1) { 91 ["num"]=> 92 string(1) "0" 93} 94object(GMP)#2 (1) { 95 ["num"]=> 96 string(4) "1764" 97} 98object(GMP)#2 (1) { 99 ["num"]=> 100 string(2) "42" 101} 102object(GMP)#2 (1) { 103 ["num"]=> 104 string(1) "2" 105} 106object(GMP)#2 (1) { 107 ["num"]=> 108 string(2) "40" 109} 110object(GMP)#2 (1) { 111 ["num"]=> 112 string(3) "168" 113} 114object(GMP)#2 (1) { 115 ["num"]=> 116 string(2) "10" 117} 118