--- /dev/null
+--TEST--
+bcadd() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcadd('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcadd('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcadd(): Argument #1 ($num1) is not well-formed
+bcadd(): Argument #2 ($num2) is not well-formed
--- /dev/null
+--TEST--
+bccomp() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bccomp('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bccomp('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bccomp(): Argument #1 ($num1) is not well-formed
+bccomp(): Argument #2 ($num2) is not well-formed
--- /dev/null
+--TEST--
+bcdiv() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcdiv('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcdiv('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcdiv(): Argument #1 ($num1) is not well-formed
+bcdiv(): Argument #2 ($num2) is not well-formed
--- /dev/null
+--TEST--
+bcmod() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcmod('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcmod('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcmod(): Argument #1 ($num1) is not well-formed
+bcmod(): Argument #2 ($num2) is not well-formed
--- /dev/null
+--TEST--
+bcmul() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcmul('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcmul('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcmul(): Argument #1 ($num1) is not well-formed
+bcmul(): Argument #2 ($num2) is not well-formed
--- /dev/null
+--TEST--
+bcpow() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcpow('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcpow('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcpow(): Argument #1 ($num) is not well-formed
+bcpow(): Argument #2 ($exponent) is not well-formed
--- /dev/null
+--TEST--
+bcpowmod() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcpowmod('a', '1', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcpowmod('1', 'a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcpowmod('1', '1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcpowmod(): Argument #1 ($num) is not well-formed
+bcpowmod(): Argument #2 ($exponent) is not well-formed
+bcpowmod(): Argument #3 ($modulus) is not well-formed
--- /dev/null
+--TEST--
+bcsqrt() requires a well-formed value
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcsqrt('a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcsqrt(): Argument #1 ($num) is not well-formed
--- /dev/null
+--TEST--
+bcsub() requires well-formed values
+--SKIPIF--
+<?php
+if (!extension_loaded('bcmath')) die('skip bcmath extension not available');
+?>
+--FILE--
+<?php
+
+try {
+ bcsub('a', '1');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+try {
+ bcsub('1', 'a');
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
+?>
+--EXPECT--
+bcsub(): Argument #1 ($num1) is not well-formed
+bcsub(): Argument #2 ($num2) is not well-formed
echo $e->getMessage() . PHP_EOL;
}
+try {
+ echo bcadd("1.a", "2");
+} catch (\ValueError $e) {
+ echo $e->getMessage() . PHP_EOL;
+}
+
echo "\n";
echo bccomp("1", "2"),"\n";
bcadd(): Argument #1 ($num1) is not well-formed
bcadd(): Argument #1 ($num1) is not well-formed
bcadd(): Argument #1 ($num1) is not well-formed
+bcadd(): Argument #1 ($num1) is not well-formed
-1
-1