note 84349 added to function.base64-decode

From: Date: Thu, 10 Jul 2008 03:38:15 +0000
Subject: note 84349 added to function.base64-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-141345@lists.php.net to get a copy of this message
To follow up on Starson's post, PHP was changed to no longer treat a space as if it were a plus sign in CVS revision 1.43.2.1, which corresponds to PHP 5.1.0. You can see what happened with a diff to branch point 1.43 at: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/base64.c The CVS log indicates that this change was made to fix bug #34214 (base64_decode() does not properly ignore whitespace). It would seem from the comment preceding the code which was removed that the treatment of the space as if it were the plus sign was actually intentional at one time: When Base64 gets POSTed, all pluses are interpreted as spaces. This line changes them back. It's not exactly the Base64 spec, but it is completely compatible with it (the spec says that spaces are invalid). This will also save many people considerable headache. if (ch == ' ') ch = '+'; However, RFC 3548 states that characters not in the Base64 alphabet should either be ignored or cause the implementation to reject the encoding and RFC 2045 says they should be ignored. So the original code was unfortunately not fully compatible with the spec or other implementations. It may have also masked problems with code not properly escaping POST variables. ---- Server IP: 209.41.74.194 Probable Submitter: 67.18.248.242 (proxied: 127.0.0.1) ---- Manual Page -- http://www.php.net/manual/en/function.base64-decode.php Edit -- https://master.php.net/note/edit/84349 Del: integrated -- https://master.php.net/note/delete/84349/integrated Del: useless -- https://master.php.net/note/delete/84349/useless Del: bad code -- https://master.php.net/note/delete/84349/bad+code Del: spam -- https://master.php.net/note/delete/84349/spam Del: non-english -- https://master.php.net/note/delete/84349/non-english Del: in docs -- https://master.php.net/note/delete/84349/in+docs Del: other reasons-- https://master.php.net/note/delete/84349 Reject -- https://master.php.net/note/reject/84349 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141345) next »