#48175 [Opn->Csd]: FILE_IGNORE_NEW_LINES does not remove "\r\n"
| From: | lbarnaud@php.net | Date: | Fri, 08 May 2009 10:08:07 +0000 |
| Subject: | #48175 [Opn->Csd]: FILE_IGNORE_NEW_LINES does not remove "\r\n" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136980@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: Closed
Bug Type: Filesystem function related
Operating System: *
PHP Version: 5.2.9
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fix merged to 5.2CVS and 6CVS
Previous Comments:
------------------------------------------------------------------------
[2009-05-07 14:48:03] carsten_sttgt at gmx dot de
executed with "php.exe -n test.php":
5.2.10-dev - Thu, 07 May 2009 11:42:06 +0100
101
101
13
5.3.0RC1 - Tue, 24 Mar 2009 22:33:04 +0000
5.3.0RC3-dev - Thu, 07 May 2009 13:08:08 +0000
101
101
101
6.0.0-dev - hu, 07 May 2009 11:30:12 +0000
13
101
101
So it's seems to be fixed in PHP5.3.
- is there a plan to release this PHP5.2.10 (have still the old
behavior)?
- is this result expected in PHP6 (and why)?
------------------------------------------------------------------------
[2009-05-07 13:46:44] lbarnaud@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[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