#37244 [Asn->Csd]: base64_decode violates RFC 3548

From: Date: Sat, 06 May 2006 22:47:20 +0000
Subject: #37244 [Asn->Csd]: base64_decode violates RFC 3548
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-96748@lists.php.net to get a copy of this message
ID: 37244 Updated by: iliaa@php.net Reported By: nohn@php.net -Status: Assigned +Status: Closed Bug Type: URL related Operating System: Irrelevant PHP Version: 5CVS-2006-04-29 (CVS) Assigned To: iliaa New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2006-04-29 13:58:29] nohn@php.net 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 this bug report at http://bugs.php.net/?id=37244&edit=1

« previous php.bugs (#96748) next »