php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #3551 base_convert()
Submitted: 2000-02-21 11:57 UTC Modified: 2002-01-28 16:50 UTC
From: rs at aelea dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0 OS: Linux 2.2.14
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rs at aelea dot com
New email:
PHP Version: OS:

 

 [2000-02-21 11:57 UTC] rs at aelea dot com
base_convert() does not accept values larger than 31 bits (e.g. 7 hex chars = 28bits is OK, 8 hex chars at 32 bits is not) 

Appears in the code that the string is converted to a signed long. 

a) should at least report an error if value > 31 bits.
b) Would be helpful to operate on larger values, e.g. md5 hashes, which are 128 bits or even on double hashes at 256 bits. 

c) would be easy to increase bases to 64 from 36 by making 
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; in ext/standard/math.c (_php_math_longtobase())) which would work for most things (e.g. URLs & GET method) as well as filenames. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-01 17:03 UTC] hholzgra@php.net
moved to "feature request"
 [2001-02-10 14:10 UTC] jimw@php.net
refiled against 4.0.
 [2002-01-28 16:50 UTC] yohgaki@php.net
Implemented
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 23:01:28 2025 UTC