Bug #3446: base64 decoding should be smart
| From: | turadg at wise dot berkeley dot edu | Date: | Thu, 10 Feb 2000 07:10:19 +0000 |
| Subject: | Bug #3446: base64 decoding should be smart | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-15345@lists.php.net to get a copy of this message | ||
From: turadg@wise.berkeley.edu
Operating system: Linux
PHP version: 3.0.14
PHP Bug Type: Feature/Change Request
Bug description: base64 decoding should be smart
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 = '+';