Skip to content

Commit

Permalink
Fixed issue #13337: Fail on CSV token import when import file with Ma…
Browse files Browse the repository at this point in the history
…c line endings
  • Loading branch information
c-schmitz committed Sep 4, 2018
1 parent 8287185 commit 9419b90
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions application/controllers/admin/tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -1924,13 +1924,13 @@ public function import($iSurveyId)
Yii::app()->setFlashMessage(sprintf(gT("Upload file not found. Check your permissions and path (%s) for the upload directory"), $sPath), 'error');
} else {
$iRecordImported = 0;
$iRecordCount = 0;
$iRecordCount = 0;
$iRecordOk = 0;
$iInvalidEmailCount = 0; // Count invalid email imported
// This allows to read file with MAC line endings too
@ini_set('auto_detect_line_endings', 'true');
@ini_set('auto_detect_line_endings', '1');
// open it and trim the endings
$aTokenListArray = file($sFileName);
$aTokenListArray = file($sFileName, FILE_SKIP_EMPTY_LINES);
$sBaseLanguage = Survey::model()->findByPk($iSurveyId)->language;
if (!Yii::app()->request->getPost('filterduplicatefields') || (Yii::app()->request->getPost('filterduplicatefields') && count(Yii::app()->request->getPost('filterduplicatefields')) == 0)) {
$aFilterDuplicateFields = array('firstname', 'lastname', 'email');
Expand Down
6 changes: 3 additions & 3 deletions application/core/LSYii_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ protected function _init()

if (Yii::app()->getConfig('debug') == 1) {
//For debug purposes - switch on in config.php
@ini_set("display_errors", 1);
@ini_set("display_errors", '1');
error_reporting(E_ALL);
} elseif (Yii::app()->getConfig('debug') == 2) {
//For debug purposes - switch on in config.php
@ini_set("display_errors", 1);
@ini_set("display_errors", '1');
error_reporting(E_ALL | E_STRICT);
} else {
@ini_set("display_errors", 0);
@ini_set("display_errors", '0');
error_reporting(0);
}

Expand Down
2 changes: 1 addition & 1 deletion application/models/SettingGlobal.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ static public function increaseCustomAssetsversionnumber()
*/
static public function increaseAssetsversionnumber()
{
@ini_set('auto_detect_line_endings', true);
@ini_set('auto_detect_line_endings', '1');
$sRootdir = Yii::app()->getConfig("rootdir");
$versionlines = file($sRootdir.DIRECTORY_SEPARATOR.'application'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'version.php');
$handle = fopen($sRootdir.DIRECTORY_SEPARATOR.'application'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'version.php', "w");
Expand Down
2 changes: 1 addition & 1 deletion application/models/UpdateForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ public function republishAssets()
public function updateVersion($destinationBuild)
{
$destinationBuild = (int) $destinationBuild;
@ini_set('auto_detect_line_endings', true);
@ini_set('auto_detect_line_endings', '1');
$versionlines = file($this->rootdir.DIRECTORY_SEPARATOR.'application'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'version.php');
$handle = fopen($this->rootdir.DIRECTORY_SEPARATOR.'application'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'version.php', "w");
foreach ($versionlines as $line) {
Expand Down

1 comment on commit 9419b90

@Shnoulle
Copy link
Collaborator

@Shnoulle Shnoulle commented on 9419b90 May 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arg ini_set ( string $varname , string $newvalue )

👍

Please sign in to comment.