php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #3446 base64 decoding should be smart
Submitted: 2000-02-10 08:10 UTC Modified: 2000-02-10 10:45 UTC
From: turadg at wise dot berkeley dot edu Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0.14 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: turadg at wise dot berkeley dot edu
New email:
PHP Version: OS:

 

 [2000-02-10 08:10 UTC] turadg at wise dot berkeley dot edu
I want to contribute this patch to the base64_decode function, but I don't want to set up CVS if I don't have to.  Please let me know if I should try this instead through CVS.

base64_decode is part of the URL functions set, but it doesn't handle base64 that's been POSTed.  After POSTing, all the pluses turn to spaces.  This code makes the base64_decode smart enough to deal with that.  It's not entirely necessary, but it will save people time and hair-pulling and there are no cons.

[turadg@wise ~]$ diff base64.c
/usr/local/src/php-3.0.14/functions/base64.c
96,102d95
<               /* When Base64 gets POSTed, all pluses are interpreted as spaces.
<                  This line changes them back.  It's not exactly the Base64 spec,
<                  but it is completely compatible with it (the spec says that
<                  spaces are invalid).  This will also save many people considerable
<                  headache.  - Turadg Aleahmad <turadg@wise.berkeley.edu>
<               */
<            if (ch == ' ') ch = '+';

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-02-10 10:45 UTC] thies at cvs dot php dot net
patch applied to PHP 3&4 thanx.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 09:01:33 2025 UTC