php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32873 file_get_contents appends \n
Submitted: 2005-04-28 20:17 UTC Modified: 2005-04-28 20:28 UTC
From: mbm at interflow dot dk Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.0.3 OS: FreeBSD 5.2
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: mbm at interflow dot dk
New email:
PHP Version: OS:

 

 [2005-04-28 20:17 UTC] mbm at interflow dot dk
Description:
------------
When loading a file with file_get_contents theres an \n appended to the content.

Reproduce code:
---------------
echo "foo" > file.txt
php -r 'var_dump(file_get_contents("file.txt"));'

Expected result:
----------------
string(3) "foo"


Actual result:
--------------
string(4) "foo
"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-28 20:28 UTC] derick@php.net
The echo shell command does this by default.
Use "echo -n" to prevent it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 30 04:01:30 2024 UTC