#48175 [Opn->Fbk]: FILE_IGNORE_NEW_LINES don't remove "\r\n"
| From: | lbarnaud@php.net | Date: | Thu, 07 May 2009 13:46:44 +0000 |
| Subject: | #48175 [Opn->Fbk]: FILE_IGNORE_NEW_LINES don't remove "\r\n" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136941@lists.php.net to get a copy of this message | ||
ID: 48175
Updated by: lbarnaud@php.net
Reported By: carsten_sttgt at gmx dot de
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: *
PHP Version: 5.2.9
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2009-05-07 12:42:05] jani@php.net
See also bug #44034
------------------------------------------------------------------------
[2009-05-07 09:23:02] carsten_sttgt at gmx dot de
Description:
------------
Hello,
if I use FILE_IGNORE_NEW_LINES with file(), a "\r\n" will not be
removed. It works with a single "\r" or "\n".
(Tested on *nix and Windows.)
Regards,
Carsten
Reproduce code:
---------------
<?php
ini_set('auto_detect_line_endings', '1');
$f = tempnam('', 'php');
file_put_contents($f, "one\ntwo\n");
$a = file($f, FILE_IGNORE_NEW_LINES);
echo ord($a[0][strlen($a[0]) - 1]).PHP_EOL;
file_put_contents($f, "one\rtwo\r");
$a = file($f, FILE_IGNORE_NEW_LINES);
echo ord($a[0][strlen($a[0]) - 1]).PHP_EOL;
file_put_contents($f, "one\r\ntwo\r\n");
$a = file($f, FILE_IGNORE_NEW_LINES);
echo ord($a[0][strlen($a[0]) - 1]).PHP_EOL;
unlink($f);
?>
Expected result:
----------------
101
101
101
Actual result:
--------------
101
101
13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48175&edit=1