php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34214 base64_decode() does not properly ignore whitespace
Submitted: 2005-08-22 23:39 UTC Modified: 2005-08-26 05:33 UTC
From: dev at worldlinked dot net Assigned:
Status: Closed Package: Strings related
PHP Version: 5CVS, 6CVS, 4CVS (2005-08-24) OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 - 5 = ?
Subscribe to this entry?

 
 [2005-08-22 23:39 UTC] dev at worldlinked dot net
Description:
------------
RFC 2045 says:
"All line breaks or other characters not found in Table 1 must be ignored by decoding software."

However if a caracter such as a space is in the encoded data (which some encoders such as newegg.com do) then the base64_decode does not work.

Reproduce code:
---------------
http://www.worldlinked.net/blog/files/testbase64.php
or
http://www.worldlinked.net/blog/files/testbase64.phps


Expected result:
----------------
Hello, There seems to be a problem with php's base64_decode() function. Whitespace needs to be trimmed from the email before it will properly decode.

Actual result:
--------------
Hello, There seems to be a problem with php's base64_decode() function. Whitespace needs to be trimmed from the em?????????ɔ??Ёݥ????ɽ??ɱ䁑??????

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-23 00:08 UTC] dev at worldlinked dot net
This bug was first reported in
http://bugs.php.net/bug.php?id=1596 
however the patch listed there was either never applied or does not work.
 [2005-08-23 22:59 UTC] dev at worldlinked dot net
Hmm, Im pretty sure it still fails.  We tried it also with 4.4.0. I did notice though that if you cut and paste the phps file that the spaces do not appear in $enctext in the first line.  Perhaps you can try again and manually put spaces at the beginning of each line, or you can download a tgz of the php file here:

http://www.worldlinked.net/blog/files/testbase64.tgz
 [2005-08-26 05:33 UTC] iliaa@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC