summaryrefslogtreecommitdiff
path: root/ext/bcmath/tests/bcpowmod_error.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bcmath/tests/bcpowmod_error.phpt')
-rw-r--r--ext/bcmath/tests/bcpowmod_error.phpt32
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/bcmath/tests/bcpowmod_error.phpt b/ext/bcmath/tests/bcpowmod_error.phpt
new file mode 100644
index 0000000000..9056f9e755
--- /dev/null
+++ b/ext/bcmath/tests/bcpowmod_error.phpt
@@ -0,0 +1,32 @@
+--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