#36269 [NEW]: Output of base64_decode differes between 4.3.11 and 5.1.2
| From: | jim at adicio dot com | Date: | Fri, 03 Feb 2006 00:17:31 +0000 |
| Subject: | #36269 [NEW]: Output of base64_decode differes between 4.3.11 and 5.1.2 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-92860@lists.php.net to get a copy of this message | ||
From: jim at adicio dot com
Operating system: *
PHP version: 5.1.2
PHP Bug Type: URL related
Bug description: Output of base64_decode differes between 4.3.11 and 5.1.2
Description:
------------
This potential bug is very similar to bug report #36106
We recently upgraded php from 4.3.11 to 5.1.2 and discovered
that the base64_decode results are different for complex
strings sent as url paremeters
For example ?complexString=<someComplexStringHere>
However, this bug can only be reproduced when the data is sent
as a query string parameter or posted, but not reproducible
when the complex string is hard coded. More details are in the
comments of the sample code.
Reproduce code:
---------------
<?php
/**
Paste the following string as:
http://localhost/bugTest.php?complexString=<complexString>
http://localhost/bugTest.php?complexString=Kq00JbxAQAV9P6aBvE3JoIpHkfkMqp6qeDATf4yC5ZFd9xJPfSLoPSGvGKxRyS/z9dYNLA1PS8cXB2MLPWe4KW5mphBtpPrafZnn06nplxNOqDwa3ebjC43CF3jMZ0n3AUW/rU/Tdtb8OS1s1OkfEc9onsT7Cvo4QTijmRDMi6KirQahsbkNdYPQ0NnPuAbMEtu/64loalKlRd/9Z+7+KkrNzxJMTiXVHMT084DOp45nX4B8jQRO1bUqkDCAMntGCyS16F3mDukY4hrTF7T40ZYHA/FVSVh5vqiWAiVwa+D3Z7Lvm4aIQnwg0CKFf9ZNFgn40L3Itb9HqGTmay5IAr1+9CxTzLYzf5PCdc0h5Z6HS4jk1FgSpWC9JFaLLrBjYa3x8lZt91Lmf5q6ygHdbdN4dwNw8CFvJRVXLMrMNOmJRx/PrpUjl6sxdrJLogDZ8w1i3+FSsd6Au9KlicYCw7fDxWE4EWWE6PlBjak9zpFFRW4U+Q6NF8m65Esx0T0s8x62yoJwimwHAn3RlEkjBDkJDk0NXmYsdg6QZl/0O08NNWQuk2mxBUY4f9PJcP6/M1pmpXBk9jmH/FA02Dk5LQ==
*/
$data =$_REQUEST['complexString'];
echo 'md5 of $_REQUEST: ' . md5($data); //
0eb27567360d44463acf0828ae5b9c7b same on php 4.3.11 as php 5.1.2
echo "<br/>\n";
$b64 = base64_decode($data);
if ($b64){
echo 'md5 after base64_decode: ' . md5($b64); // this is different: php
5.1.2=d506a6d5fa0e18eb471eda4d636ec282
php4.3.11=9e903ee99934d554828979fe2221dd3e
}
$complexStringHardCoded="Kq00JbxAQAV9P6aBvE3JoIpHkfkMqp6qeDATf4yC5ZFd9xJPfSLoPSGvGKxRyS/z9dYNLA1PS8cXB2MLPWe4KW5mphBtpPrafZnn06nplxNOqDwa3ebjC43CF3jMZ0n3AUW/rU/Tdtb8OS1s1OkfEc9onsT7Cvo4QTijmRDMi6KirQahsbkNdYPQ0NnPuAbMEtu/64loalKlRd/9Z+7+KkrNzxJMTiXVHMT084DOp45nX4B8jQRO1bUqkDCAMntGCyS16F3mDukY4hrTF7T40ZYHA/FVSVh5vqiWAiVwa+D3Z7Lvm4aIQnwg0CKFf9ZNFgn40L3Itb9HqGTmay5IAr1+9CxTzLYzf5PCdc0h5Z6HS4jk1FgSpWC9JFaLLrBjYa3x8lZt91Lmf5q6ygHdbdN4dwNw8CFvJRVXLMrMNOmJRx/PrpUjl6sxdrJLogDZ8w1i3+FSsd6Au9KlicYCw7fDxWE4EWWE6PlBjak9zpFFRW4U+Q6NF8m65Esx0T0s8x62yoJwimwHAn3RlEkjBDkJDk0NXmYsdg6QZl/0O08NNWQuk2mxBUY4f9PJcP6/M1pmpXBk9jmH/FA02Dk5LQ==";
echo "<br/>\n";
echo 'md5 of hard-coded complex string after base64_decode: ' .
md5(base64_decode($complexStringHardCoded)); //same md5 on php 4.3.11 as
5.1.2
?>
Expected result:
----------------
Same md5 checksums of base64_decoded string on php 4.3.11 as
5.1.2
Actual result:
--------------
Different md5 checksums of base64_decoded string on php 4.3.11
than 5.1.2
I'm inclined to believe the potential bug is in 5.1.2 because
this sample string represents encrypted data which was
successfully base64_decoded and decrypted in 4.3.11 but was
garbage in 5.1.2
Thanks!
--
Edit bug report at http://bugs.php.net/?id=36269&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36269&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36269&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36269&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36269&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36269&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36269&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36269&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36269&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36269&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36269&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36269&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36269&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36269&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36269&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36269&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36269&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36269&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36269&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36269&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36269&r=mysqlcfg