From: David Soria Parra Date: Wed, 25 Nov 2009 18:15:25 +0000 (+0000) Subject: Really use 62 as the upper boundary as requested and not 32. X-Git-Tag: php-5.4.0alpha1~191^2~2340 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f6bb82eb37242e3e780cc35ce92b3ae7cf9b9079;p=php Really use 62 as the upper boundary as requested and not 32. --- diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index ebfe39ae2f..c9da712fd8 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -804,7 +804,7 @@ ZEND_FUNCTION(gmp_strval) return; } - if ((base < 2 && base > -2) || base > 36 || base < -36) { + if ((base < 2 && base > -2) || base > 62 || base < -36) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %ld", base); RETURN_FALSE; } diff --git a/ext/gmp/tests/bug50283.phpt b/ext/gmp/tests/bug50283.phpt index 4842c00598..d2c3165fa7 100644 --- a/ext/gmp/tests/bug50283.phpt +++ b/ext/gmp/tests/bug50283.phpt @@ -5,25 +5,29 @@ Feature Request #50283 (allow base in gmp_strval to use full range: 2 to 62, and --FILE-- --EXPECTF-- -Decimal: 71915494046709, 36-based: PHPISCOOL +Decimal: 71915494046709, -36-based: PHPISCOOL Decimal: 71915494046709, 36-based: phpiscool Warning: gmp_strval(): Bad base for conversion: -1 in %s on line 5 -Decimal: 71915494046709, 36-based: +Decimal: 71915494046709, -1-based: Warning: gmp_strval(): Bad base for conversion: 1 in %s on line 6 -Decimal: 71915494046709, 36-based: +Decimal: 71915494046709, 1-based: Warning: gmp_strval(): Bad base for conversion: -37 in %s on line 7 -Decimal: 71915494046709, 36-based: +Decimal: 71915494046709, -37-based: +Decimal: 71915494046709, 37-based: KHKATELJF +Decimal: 71915494046709, 62-based: KQ6yq741 -Warning: gmp_strval(): Bad base for conversion: 37 in %s on line 8 -Decimal: 71915494046709, 36-based: +Warning: gmp_strval(): Bad base for conversion: 63 in %s on line 10 +Decimal: 71915494046709, 63-based: