]> granicus.if.org Git - php/commitdiff
@- base64_decode() will decode POST data correct. (Thies)
authorThies C. Arntzen <thies@php.net>
Thu, 10 Feb 2000 09:44:22 +0000 (09:44 +0000)
committerThies C. Arntzen <thies@php.net>
Thu, 10 Feb 2000 09:44:22 +0000 (09:44 +0000)
@  Patch submitted by: Turadg Aleahmad <turadg@wise.berkeley.edu>

ext/standard/base64.c

index cce691f0bf296e3334c3fc760b068e274a3287a1..d3ddbd17ffb03e06768d8969449c39423f8a0a54 100644 (file)
@@ -96,6 +96,16 @@ unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_
        /* run through the whole string, converting as we go */
        while ((ch = *current++) != '\0') {
                if (ch == base64_pad) break;
+
+           /* 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 = '+'; 
+
                ch = reverse_table[ch];
                if (ch < 0) continue;