php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: roiputrop at mailinator dot com
New email:
PHP Version: OS:

 

 [2006-07-26 11:01 UTC] roiputrop at mailinator dot com
Description:
------------
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("http://bugs.php.net/gifs/logo-bug.gif") );
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-26 16:34 UTC] tony2001@php.net
Use chunk_split() to split the string.
http://php.net/chunk_split
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 15:01:23 2019 UTC