#36106 [Opn]: Output of base64_decode differs between 5.0.4 and 5.1.2
| From: | schapht at verizon dot net | Date: | Fri, 20 Jan 2006 16:28:53 +0000 |
| Subject: | #36106 [Opn]: Output of base64_decode differs between 5.0.4 and 5.1.2 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-92302@lists.php.net to get a copy of this message | ||
ID: 36106
User updated by: schapht at verizon dot net
Reported By: schapht at verizon dot net
Status: Open
Bug Type: URL related
Operating System: CentOS 4.1
PHP Version: 5.1.2
New Comment:
Sorry... Above code is incorrect, the following is the script under
test:
<?php
$easyString = "SGVsbG8gV29ybGQh";
$complexString = "B
5mvYwuEVli6vkhSUH9dRwpxUWe6LdXQOV8PTak0nlftEZ8lMwnib7 Z
SJQt5gXtf1FirG3p8ryIM6JBVVBRH9ceS5jXkCvi4Y4X8HAAIWyujb1WHOpDIItQ1ixLul1ylezCkBZC5iGDlH/IchuPUMtvnoP9FeOy5CwQ==";
echo "Easy : ". base64_decode($easyString) ."\n";
echo "Complex (fed through md5): ". md5(base64_decode($complexString))
."\n";
?>
Previous Comments:
------------------------------------------------------------------------
[2006-01-20 17:27:47] schapht at verizon dot net
Description:
------------
The decoding behavior of base64_decode seems to have changed between
5.0.4 and 5.1.2.
A simple case like 'SGVsbG8gV29ybGQh' (Hello World!) works, bu this
more complex case (an already encrypted string) breaks.
NOTE: The reason I'm feeding the $complexString output into md5 is that
is contains many unprintable characters because the base64_encrypted
string is an already blowfish-encrypted string.
Reproduce code:
---------------
<?php
$string = "B 5mvYwuEVli6vkhSUH9dRwpxUWe6LdXQOV8PTak0nlftEZ8lMwnib7 Z
SJQt5gXtf1FirG3p8ryIM6JBVVBRH9ceS5jXkCvi4Y4X8HAAIWyujb1WHOpDIItQ1ixLul1ylezCkBZC5iGDlH/IchuPUMtvnoP9FeOy5CwQ==";
echo md5(base64_decode($string));
echo "\n";
?>
Expected result:
----------------
[schapht@dev ~]$ /usr/local/src/php-5.1.2/sapi/cli/php test.php
Easy : Hello World!
Complex (fed through md5): 10a36e3377f55d981af2b547971ff3da
[schapht@dev ~]$ /usr/local/src/php-5.0.4/sapi/cli/php test.php
Easy : Hello World!
Complex (fed through md5): 10a36e3377f55d981af2b547971ff3da
Actual result:
--------------
[schapht@dev ~]$ /usr/local/src/php-5.1.2/sapi/cli/php test.php
Easy : Hello World!
Complex (fed through md5): 52054f13d2bc7b82cd55bcb37c02b32b
[schapht@dev ~]$ /usr/local/src/php-5.0.4/sapi/cli/php test.php
Easy : Hello World!
Complex (fed through md5): 10a36e3377f55d981af2b547971ff3da
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36106&edit=1