summaryrefslogtreecommitdiff
path: root/ext/gmp/gmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gmp/gmp.c')
-rw-r--r--ext/gmp/gmp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index d4d7e30c52..ee3751712c 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -796,14 +796,14 @@ ZEND_FUNCTION(gmp_strval)
return;
}
- if (base < 2 || base > 36) {
+ if ((base < 2 && base > -2) || base > 36 || base < -36) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %ld", base);
RETURN_FALSE;
}
FETCH_GMP_ZVAL(gmpnum, gmpnumber_arg, temp_a);
- num_len = mpz_sizeinbase(*gmpnum, base);
+ num_len = mpz_sizeinbase(*gmpnum, abs(base));
out_string = emalloc(num_len+2);
if (mpz_sgn(*gmpnum) < 0) {
num_len++;