#32873 [Opn->Bgs]: file_get_contents appends \n
| From: | derick@php.net | Date: | Thu, 28 Apr 2005 18:28:13 +0000 |
| Subject: | #32873 [Opn->Bgs]: file_get_contents appends \n | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-78383@lists.php.net to get a copy of this message | ||
ID: 32873
Updated by: derick@php.net
Reported By: mbm at interflow dot dk
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: FreeBSD 5.2
PHP Version: 5.0.3
New Comment:
The echo shell command does this by default.
Use "echo -n" to prevent it.
Previous Comments:
------------------------------------------------------------------------
[2005-04-28 20:17:06] 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
"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32873&edit=1