#50942 [Opn]: gmp_strval() only allows base 2 to 36

From: Date: Wed, 17 Feb 2010 05:35:49 +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-3918@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 Bug Type: Documentation problem Operating System: GNU/Linux PHP Version: 5.2.12 New Comment: What version of GMP is PHP compiled against? For the extended range to be possible, you must be using GMP 4.2 or greater Previous Comments: ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#3918) next »