php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53708 base_convert could go to base 62 or 64
Submitted: 2011-01-10 17:07 UTC Modified: 2011-01-12 04:47 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jimktrains at gmail dot com Assigned:
Status: Wont fix Package: Math related
PHP Version: trunk-SVN-2011-01-10 (SVN) OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-01-10 17:07 UTC] jimktrains at gmail dot com
Description:
------------
base_convert (http://php.net/manual/en/function.base-convert.php) should/could go to base 62 (0-9a-zA-Z) or base64 (standard encoding).

This change would be backwards compatible.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-12 04:47 UTC] aharvey@php.net
-Status: Open +Status: Wont fix -Package: *General Issues +Package: Math related
 [2011-01-12 04:47 UTC] aharvey@php.net
The mapping of values to characters occurs in a different order in
"standard" Base64 to the way base_convert() currently works, so
extending base_convert() out to 64 wouldn't make much sense, since it
would either be inconsistent with the existing behaviour of
base_convert() or base64_encode(), and either way I can only see it
confusing people.

Going to 62 would be possible, but as a cursory Web search for Base62
shows, there's no real standard -- even an informal one -- for how the
character set is ordered: the most common order seems to be 0-9a-zA-Z,
but there are plenty of examples of 0-9A-Za-z as well, not to mention
implementations that are simple variants of Base64 (which is, of
course, A-Za-z0-9, then two non-alphanumeric characters that nobody
seems to be able to agree on).

While it would be nice to have a Base62 conversion function (since it
is quite useful in URLs), I don't think the PHP standard library is
the place for it at the moment; developers will be better off using an
implementation that implements the actual variant they want.

Closing won't fix.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 04:01:26 2019 UTC