#45115 [Opn->Bgs]: Problem with fgets and \ followed by n
ID: 45115
Updated by: jani@php.net
Reported By: gabriel dot magniez at steria dot com
-Status: Open
+Status: Bogus
Bug Type: Streams related
Operating System: Linux (Debian)
PHP Version: 5.2.6
New Comment:
Don't use fgets() then, use fread().
Previous Comments:
------------------------------------------------------------------------
[2008-05-28 12:44:53] gabriel dot magniez at steria dot com
Description:
------------
When I read a stream line by line with the function fgets, this
function seems to interprete the two characters "\" followed by "n" as
the "\n" (end of line) character.
My problem is that I attemp to read a shell script which contains these
two characters but I would like that fgets don't transform these into
the control character "\n".
Reproduce code:
---------------
$str = fgets($this->stream)
Expected result:
----------------
Only on line (ex: echo "abc\ndef")
Actual result:
--------------
Two lines:
echo "abc
def"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45115&edit=1
Thread (2 messages)