#50942 [Opn]: gmp_strval() only allows base 2 to 36
| From: | php dot devel at homelinkcs dot com | Date: | Fri, 05 Feb 2010 20:26:43 +0000 |
| Subject: | #50942 [Opn]: gmp_strval() only allows base 2 to 36 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3829@lists.php.net to get a copy of this message | ||
ID: 50942
User updated by: php dot devel at homelinkcs dot com
Reported By: php dot devel at homelinkcs dot com
Status: Open
Bug Type: Documentation problem
Operating System: GNU/Linux
PHP Version: 5.2.12
New Comment:
Sorry, s/26/36/ in second sentence and s/27/37/ in last sentence.
Previous Comments:
------------------------------------------------------------------------
[2010-02-05 20:22:33] php dot devel at homelinkcs dot com
Description:
------------
The manual says that as of PHP 5.2.12, the range for the base argument
to gmp_strval() was extended from 2 to 36, to 2 to 62 and -2 to -36.
However, in my tests only 2 to 26 worked.
Reproduce code:
---------------
foreach (array_merge(range(-2, -36), range(2, 62)) as $num) {
if (@gmp_strval(gmp_init(62), $num)) echo "Base $num: GOOD\n";
else echo "Base $num: BAD\n";
}
Expected result:
----------------
gmp_strval() should return a value for all bases in specified range.
Actual result:
--------------
gmp_strval() fails to return a value and gives warning, "Bad base for
conversion", for bases -2 to -36 and 27 to 62.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50942&edit=1