php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63341 auto_detect_line_endings does not work with MAC files
Submitted: 2012-10-23 15:10 UTC Modified: -
Votes:5
Avg. Score:4.6 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:2 (50.0%)
From: tony at marston-home dot demon dot co dot uk Assigned:
Status: Open Package: Filesystem function related
PHP Version: 5.4.8 OS: Windows 7
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-10-23 15:10 UTC] tony at marston-home dot demon dot co dot uk
Description:
------------
auto_detect_line_endings does not work with a CSV file containing MAC line endings.

Test script:
---------------
File 'mac-linebreaks.csv' contains the following:

label1,label2,label3\r
1a,1b,1c\r
2a,2b,2c\r
3a,3b,3c\r
4a,4b,4c\r

Each line terminates with carriage-return only "\r".

$handle = @fopen('mac-linebreaks.csv', 'r');
ini_set('auto_detect_line_endings', true);
$first = fgets($handle);

The variable $first now contains the whole file.

Expected result:
----------------
The variable $first should contain everything up to the first carriage-return, i.e. "label1,label2,label3"


Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 12:01:59 2014 UTC