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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 13:01:29 2024 UTC