ID:               48175
 Updated by:       lbarn...@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] j...@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

Reply via email to