|  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: -
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
auto_detect_line_endings does not work with a CSV file containing MAC line endings.

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


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"


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 14:02:33 2014 UTC