note 69298 added to function.base64-decode
| From: | Jes at osu1 dot php dot net | Date: | Wed, 30 Aug 2006 15:31:23 +0000 |
| Subject: | note 69298 added to function.base64-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116511@lists.php.net to get a copy of this message | ||
I've come across an interesting issue with an external program that submits a gzcompressed
base64_encoded string to PHP via POST. The external program encodes the string using the occasional
" " (space) character, however if I encode the same original string within PHP (using
base64_encode), it uses a "+" (plus) character wherever the external program would use a
space. On my deployed machine, running PHP 4.3.9, base64_decode is fine with the " "
(space) characters, but my test server running 5.1.4 is not. It took me a while to figure out that
was the issue, but I ended up fixing it with a simple:
<?php
$post_data = str_replace(" ","+",$_POST['string'])
?>
This fix works on both the 4.3.9 and 5.1.4 machines. I am sure that the external program is probably
not conforming to the standard, and it isn't a PHP problem per-se; but incase anybody else ever
runs into that.
----
Server IP: 216.194.113.175
Probable Submitter: 63.116.164.218
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.base64-decode.php
Edit -- https://master.php.net/note/edit/69298
Del: integrated -- https://master.php.net/note/delete/69298/integrated
Del: useless -- https://master.php.net/note/delete/69298/useless
Del: bad code -- https://master.php.net/note/delete/69298/bad+code
Del: spam -- https://master.php.net/note/delete/69298/spam
Del: non-english -- https://master.php.net/note/delete/69298/non-english
Del: in docs -- https://master.php.net/note/delete/69298/in+docs
Del: other reasons-- https://master.php.net/note/delete/69298
Reject -- https://master.php.net/note/reject/69298
Search -- https://master.php.net/manage/user-notes.php