diff options
author | David Soria Parra <dsp@php.net> | 2009-11-25 23:38:34 +0000 |
---|---|---|
committer | David Soria Parra <dsp@php.net> | 2009-11-25 23:38:34 +0000 |
commit | 99c43e1b934f318c9bc5d0f85b2f2edd690ae888 (patch) | |
tree | 3180d4ddd27a25cd19baaefe37f92bef51357560 /ext/gmp | |
parent | 579a6e39deb48363b905be4d80e9ff4e612c4554 (diff) | |
download | php-git-99c43e1b934f318c9bc5d0f85b2f2edd690ae888.tar.gz |
Also allow base 62 for gmp_init as requested in (#50283)
Diffstat (limited to 'ext/gmp')
-rw-r--r-- | ext/gmp/gmp.c | 2 | ||||
-rw-r--r-- | ext/gmp/tests/bug50283.phpt | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 300e33b7af..44c8154cf0 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -746,7 +746,7 @@ ZEND_FUNCTION(gmp_init) return; } - if (base && (base < 2 || base > 36)) { + if (base && (base < 2 || base > 62)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad base for conversion: %ld (should be between 2 and 36)", base); RETURN_FALSE; } diff --git a/ext/gmp/tests/bug50283.phpt b/ext/gmp/tests/bug50283.phpt index d2c3165fa7..e8132a78f3 100644 --- a/ext/gmp/tests/bug50283.phpt +++ b/ext/gmp/tests/bug50283.phpt @@ -12,7 +12,8 @@ printf("Decimal: %s, 1-based: %s\n", gmp_strval($a), gmp_strval($a,1)); printf("Decimal: %s, -37-based: %s\n", gmp_strval($a), gmp_strval($a,-37)); printf("Decimal: %s, 37-based: %s\n", gmp_strval($a), gmp_strval($a,37)); printf("Decimal: %s, 62-based: %s\n", gmp_strval($a), gmp_strval($a,62)); -printf("Decimal: %s, 63-based: %s\n", gmp_strval($a), gmp_strval($a,63)); +printf("Decimal: %s, 63-based: %s\n\n", gmp_strval($a), gmp_strval($a,63)); +printf("Base 32 and 62-based: %s\n", gmp_strval(gmp_init("gh82179fbf5", 32), 62)); ?> --EXPECTF-- Decimal: 71915494046709, -36-based: PHPISCOOL @@ -31,3 +32,5 @@ Decimal: 71915494046709, 62-based: KQ6yq741 Warning: gmp_strval(): Bad base for conversion: 63 in %s on line 10 Decimal: 71915494046709, 63-based: + +Base 32 and 62-based: 1NHkAcdIiD |