1--TEST-- 2BcMath\Number compare() 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'); 16foreach ($args as [$val, $type]) { 17 echo "{$type}:\n"; 18 try { 19 $num->compare($val); 20 } catch (Error $e) { 21 echo $e->getMessage() . "\n"; 22 } 23 echo "\n"; 24} 25?> 26--EXPECTF-- 27non number str: 28BcMath\Number::compare(): Argument #1 ($num) is not well-formed 29 30array: 31BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, array given 32 33other object: 34BcMath\Number::compare(): Argument #1 ($num) must be of type int, string, or BcMath\Number, stdClass given 35 36float: 37 38Deprecated: Implicit conversion from float 0.1 to int loses precision in %s 39 40null: 41 42Deprecated: BcMath\Number::compare(): Passing null to parameter #1 ($num) of type BcMath\Number|string|int is deprecated in %s 43