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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 01:01:33 2025 UTC