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:

I have report from a ##php user that 4.4.1 follows the same behavior as
5.1.2.  I wonder if it was something that got fixed in 5.0.4, then
somehow lost.


Previous Comments:
------------------------------------------------------------------------

[2006-01-20 17:28:52] schapht at verizon dot net

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";
?>

------------------------------------------------------------------------

[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:
----------------
[EMAIL PROTECTED] ~]$ /usr/local/src/php-5.1.2/sapi/cli/php test.php
Easy    : Hello World!
Complex (fed through md5): 10a36e3377f55d981af2b547971ff3da
[EMAIL PROTECTED] ~]$ /usr/local/src/php-5.0.4/sapi/cli/php test.php
Easy    : Hello World!
Complex (fed through md5): 10a36e3377f55d981af2b547971ff3da

Actual result:
--------------
[EMAIL PROTECTED] ~]$ /usr/local/src/php-5.1.2/sapi/cli/php test.php
Easy    : Hello World!
Complex (fed through md5): 52054f13d2bc7b82cd55bcb37c02b32b
[EMAIL PROTECTED] ~]$ /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

Reply via email to