#16521 [Com]: file() - incorrect behavior (line endings ignored) on files with Mac EOLN (CR)
| From: | dreamchimney at yahoo dot com | Date: | Thu, 19 Dec 2002 02:13:08 +0000 |
| Subject: | #16521 [Com]: file() - incorrect behavior (line endings ignored) on files with Mac EOLN (CR) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-28007@lists.php.net to get a copy of this message | ||
ID: 16521
Comment by: dreamchimney@yahoo.com
Reported By: dphelan@bcps.org
Status: Closed
Bug Type: Filesystem function related
Operating System: FreeBSD 4.5-Stable
PHP Version: 4.1.2
New Comment:
is there a work around for this? just some way to go
through the array containing the file, line by line.
Im using PHP 4.2.2
Previous Comments:
------------------------------------------------------------------------
[2002-09-23 13:36:48] wez@php.net
Fixed in HEAD.
Please try a non-stable snapshot and set the new ini option
auto_detect_line_endings=on in your php.ini/apache.conf.
The fix will be in 4.3.
--Wez.
PS: You might have to wait a couple of hours for this
change to appear on http://snaps.php.net
------------------------------------------------------------------------
[2002-06-14 13:46:42] philip@php.net
This seems critical as this is such a commonly used function. (and
Derick promised it would be fixed by 4.3.0 :)
------------------------------------------------------------------------
[2002-04-09 23:13:59] dphelan@bcps.org
In PHP 4.1.2 (and 4.2.0-dev) Calling file() on a 4-line
text file with Macintosh line endings (CR) results in a
1-element array:
file: (file.txt)
blah
test
three
four
Code:
$array = file( 'file.txt. );
echo count( $array );
>> Returns '1' (Verified by print_r)
file() is ignoring the line endings, but the correct result
happens for files with Windows (CRLF) and Unix (LF) line
endings.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16521&edit=1