From 53725d2736de79114b2ffe19f2a0e4c1fd3b54dc Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 4 Aug 2014 15:34:57 -0500
Subject: [PATCH] Handle Macintosh style line endings for CSV import

---
 include/class.user.php     | 2 ++
 setup/cli/modules/user.php | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/include/class.user.php b/include/class.user.php
index 3ee809b84..5e2ee73b0 100644
--- a/include/class.user.php
+++ b/include/class.user.php
@@ -456,6 +456,8 @@ class User extends UserModel {
 
     function importFromPost($stuff, $extra=array()) {
         if (is_array($stuff) && !$stuff['error']) {
+            // Properly detect Macintosh style line endings
+            ini_set('auto_detect_line_endings', true);
             $stream = fopen($stuff['tmp_name'], 'r');
         }
         elseif ($stuff) {
diff --git a/setup/cli/modules/user.php b/setup/cli/modules/user.php
index aef84a212..2d6d146a9 100644
--- a/setup/cli/modules/user.php
+++ b/setup/cli/modules/user.php
@@ -31,6 +31,9 @@ class UserManager extends Module {
 
         switch ($args['action']) {
             case 'import':
+                // Properly detect Macintosh style line endings
+                ini_set('auto_detect_line_endings', true);
+
                 if (!$options['file'])
                     $this->fail('CSV file to import users from is required!');
                 elseif (!($this->stream = fopen($options['file'], 'rb')))
-- 
GitLab