|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38221 base64_encode produces invalidly encoded string
Submitted: 2006-07-26 11:01 UTC Modified: 2006-07-26 16:34 UTC
From: roiputrop at mailinator dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.1.4 OS: Ubuntu 6.06 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: roiputrop at mailinator dot com
New email:
PHP Version: OS:


 [2006-07-26 11:01 UTC] roiputrop at mailinator dot com
Calling base64_encode in php does not produce valid base64 encoded string.

The lines are too long, there should be a line break every 76 characters.

Example code below.

Reproduce code:
$file = implode( "", file("") );
print base64_encode($file);

This produces a string with just one line.

Expected result:
Base 64. 114 lines of text.

Actual result:
Not base 64. One line of text.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-26 16:34 UTC]
Use chunk_split() to split the string.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 13:01:29 2024 UTC