|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-07 12:42 UTC] jani@php.net
[2009-05-07 13:46 UTC] lbarnaud@php.net
[2009-05-07 14:48 UTC] carsten_sttgt at gmx dot de
[2009-05-08 10:08 UTC] lbarnaud@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
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