#35649 [Bgs]: base64_decode bug
| From: | salmon318 at hotmail dot com | Date: | Mon, 12 Dec 2005 20:22:01 +0000 |
| Subject: | #35649 [Bgs]: base64_decode bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-90307@lists.php.net to get a copy of this message | ||
ID: 35649
User updated by: salmon318 at hotmail dot com
Reported By: salmon318 at hotmail dot com
Status: Bogus
Bug Type: Strings related
Operating System: Windows
PHP Version: 5.1.1
New Comment:
So, are you saying 5.0.5 has base64_decode bug? otherwise, how come the
result between two versions are different?
I can't find it in the ChangeLog, please correct me if I am wrong..
thanks.
http://www.php.net/ChangeLog-5.php
Previous Comments:
------------------------------------------------------------------------
[2005-12-12 20:51:07] tony2001@php.net
With "a bc" you'll get the same result as with "abc" because that's
the
way it should work according to the RFC:
"All line breaks or other characters not found in Table 1 must be
ignored by decoding software."
http://www.faqs.org/rfcs/rfc2045.html
------------------------------------------------------------------------
[2005-12-12 20:39:27] salmon318 at hotmail dot com
Description:
------------
Upgraded to 5.1.1 from 5.0.5 and our application was totally broken. We
found that base64_decode in 5.1.1 behaves differently than 5.0.5.
Basically, if there is a SPACE in the string to be decoded, problem
comes up.
There are similar article on version 4.0.x but nothing on 5.1.1 so I
think it is not fixed in 5.1.x yet.
Reproduce code:
---------------
Try the following code on both PHP 5.0.5 vs 5.1.1:
<?
$str = "a bc";
echo base64_decode($str);
?>
You will get different result. This only happens if there is a space.
Maybe base64_encode has the similar problem too.
Expected result:
----------------
Php 5.0.5 and below has this result:
kæÜ
Php 5.1.1 got this result:
i·
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35649&edit=1