From 9c881ea4d13c3d82d89999f029a1ff4a29eebbd8 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Mon, 3 Jun 2013 13:40:21 +0100 Subject: [PATCH] Fix to rewind filepointer when testing BOM marker --- Classes/PHPExcel/Reader/CSV.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Classes/PHPExcel/Reader/CSV.php b/Classes/PHPExcel/Reader/CSV.php index d43b374..d45a0c6 100644 --- a/Classes/PHPExcel/Reader/CSV.php +++ b/Classes/PHPExcel/Reader/CSV.php @@ -144,28 +144,28 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R */ protected function _skipBOM() { - rewind($fileHandle); + rewind($this->_fileHandle); switch ($this->_inputEncoding) { case 'UTF-8': fgets($this->_fileHandle, 4) == "\xEF\xBB\xBF" ? - fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0); + fseek($this->_fileHandle, 3) : fseek($this->_fileHandle, 0); break; case 'UTF-16LE': fgets($this->_fileHandle, 3) == "\xFF\xFE" ? - fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); + fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); break; case 'UTF-16BE': fgets($this->_fileHandle, 3) == "\xFE\xFF" ? - fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); + fseek($this->_fileHandle, 2) : fseek($this->_fileHandle, 0); break; case 'UTF-32LE': fgets($this->_fileHandle, 5) == "\xFF\xFE\x00\x00" ? - fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); + fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); break; case 'UTF-32BE': fgets($this->_fileHandle, 5) == "\x00\x00\xFE\xFF" ? - fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); + fseek($this->_fileHandle, 4) : fseek($this->_fileHandle, 0); break; default: break; @@ -187,7 +187,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); } $fileHandle = $this->_fileHandle; - + // Skip BOM, if any $this->_skipBOM();