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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 - 19 = ?
Subscribe to this entry?

 
 [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: Fri May 03 00:01:31 2024 UTC