#50942 [Opn->Csd]: gmp_strval() only allows base 2 to 36
| From: | kalle@php.net | Date: | Fri, 19 Feb 2010 07:55:19 +0000 |
| Subject: | #50942 [Opn->Csd]: gmp_strval() only allows base 2 to 36 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3941@lists.php.net to get a copy of this message | ||
ID: 50942
Updated by: kalle@php.net
Reported By: php dot devel at homelinkcs dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: GNU/Linux
PHP Version: 5.2.12
-Assigned To:
+Assigned To: kalle
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Seems like GMP changes never was merged to 5.3.1 (in 5.2.12 it was
removed [1]), but they are available according to the source in 5.3.2
[2][3].
[1] http://svn.php.net/viewvc?view=revision&revision=291336
[2] http://svn.php.net/viewvc?view=revision&revision=291362
[3]
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_3_2/ext/gmp/gmp.c?r1=291323&r2=291362
I've updated the relevant ChangeLog information for both gmp_init() and
gmp_strval() to reflect this change.
Previous Comments:
------------------------------------------------------------------------
[2010-02-19 07:55:14] svn@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=295245
Log: Fixed bug #50942 (gmp_strval() only allows base 2 to 36)
------------------------------------------------------------------------
[2010-02-17 18:32:08] php dot devel at homelinkcs dot com
I have GMP 4.3.2.
Also, I just tested this on another system with PHP 5.3.1 linked
against GMP 4.3.1 and got the same result.
------------------------------------------------------------------------
[2010-02-17 05:35:49] kalle@php.net
What version of GMP is PHP compiled against? For the extended range to
be possible, you must be using GMP 4.2 or greater
------------------------------------------------------------------------
[2010-02-05 20:26:43] php dot devel at homelinkcs dot com
Sorry, s/26/36/ in second sentence and s/27/37/ in last sentence.
------------------------------------------------------------------------
[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