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
 [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 Apr 19 17:01:30 2024 UTC