summaryrefslogtreecommitdiff
path: root/ext/bcmath/libbcmath/src/raise.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bcmath/libbcmath/src/raise.c')
-rw-r--r--ext/bcmath/libbcmath/src/raise.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/ext/bcmath/libbcmath/src/raise.c b/ext/bcmath/libbcmath/src/raise.c
index 700a50f50c..2e843f179a 100644
--- a/ext/bcmath/libbcmath/src/raise.c
+++ b/ext/bcmath/libbcmath/src/raise.c
@@ -52,12 +52,18 @@ bc_raise (bc_num num1, bc_num num2, bc_num *result, int scale)
int calcscale;
char neg;
- /* Check the exponent for scale digits and convert to a long. */
- if (num2->n_scale != 0)
- php_error_docref (NULL, E_WARNING, "Non-zero scale in exponent");
- exponent = bc_num2long (num2);
- if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0))
- php_error_docref (NULL, E_WARNING, "Exponent too large");
+ /* Check the exponent for scale digits and convert to a long. */
+ if (num2->n_scale != 0) {
+ /* 2nd argument from PHP_FUNCTION(bcpow) */
+ zend_argument_value_error(2, "cannot have a fractional part");
+ return;
+ }
+ exponent = bc_num2long (num2);
+ if (exponent == 0 && (num2->n_len > 1 || num2->n_value[0] != 0)) {
+ /* 2nd argument from PHP_FUNCTION(bcpow) */
+ zend_argument_value_error(2, "is too large");
+ return;
+ }
/* Special case if exponent is a zero. */
if (exponent == 0)