From: [EMAIL PROTECTED]
Operating system: Irrelevant
PHP version: 5CVS-2006-04-29 (CVS)
PHP Bug Type: URL related
Bug description: base64_decode violates RFC 3548
Description:
------------
base64_decode violates RFC 3548:
"Implementations MUST reject the encoding if it contains characters
outside the base alphabet when interpreting base encoded data, unless the
specification referring to this document explicitly states otherwise."
Reproduce code:
---------------
<?php
$strings = array(
'SW1wbGVtZW50YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu',
'SW1wbGVtZW$0YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu',
'SW1wbGVtZW0YXRpb25zIE1VU1QgcmVqZWN0IHRoZSBlbmNvZGluZyBpZiBpdCBjb250YWlucyBjaGFyYWN0ZXJzIG91dHNpZGUgdGhlIGJhc2UgYWxwaGFiZXQu'
);
foreach($strings as $string) {
var_dump(base64_decode($string));
}
?>
Expected result:
----------------
string(93) "Implementations MUST reject the encoding if it contains
characters outside the base alphabet."
bool(false)
string(92) "Implemem][ÛÈUTZXH[ÛÙ[ÈYÛÛZ[ÈÚ\XÝ\ÈÝ]ÚYHH\ÙH[X]"
Actual result:
--------------
string(93) "Implementations MUST reject the encoding if it contains
characters outside the base alphabet."
string(92) "Implemem][ÛÈUTZXH[ÛÙ[ÈYÛÛZ[ÈÚ\XÝ\ÈÝ]ÚYHH\ÙH[X]"
string(92) "Implemem][ÛÈUTZXH[ÛÙ[ÈYÛÛZ[ÈÚ\XÝ\ÈÝ]ÚYHH\ÙH[X]"
--
Edit bug report at http://bugs.php.net/?id=37244&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=37244&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=37244&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=37244&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37244&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=37244&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37244&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37244&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37244&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37244&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37244&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=37244&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=37244&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37244&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37244&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37244&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37244&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37244&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37244&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37244&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37244&r=mysqlcfg