note 69298 deleted from function.base64-decode by cmb

From: Date: Tue, 09 Jun 2015 17:02:33 +0000
Subject: note 69298 deleted from function.base64-decode by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-202791@lists.php.net to get a copy of this message
Note Submitter: Jes ---- 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.

« previous php.notes (#202791) next »