From f2076cde3fc338492867116ee0c510d0af5d003f Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Fri, 25 Nov 2011 13:34:08 +0000 Subject: [PATCH] Bugfix: Work item 16956 - External links in Excel2010 files cause Fatal error git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@83261 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Calculation.php | 9 +++++++++ changelog.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index b844b1ff..b12c960a 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -3193,6 +3193,11 @@ class PHPExcel_Calculation { $cellRef = $matches[6].$matches[7].':'.$matches[9].$matches[10]; if ($matches[2] > '') { $matches[2] = trim($matches[2],"\"'"); + if ((strpos($matches[2],'[') !== false) || (strpos($matches[2],']') !== false)) { + // It's a Reference to an external workbook (not currently supported) + return $this->_raiseFormulaError('Unable to access External Workbook'); + } + $matches[2] = trim($matches[2],"\"'"); // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
'; $this->_writeDebug('Evaluating Cell Range '.$cellRef.' in worksheet '.$matches[2]); if (!is_null($pCellParent)) { @@ -3222,6 +3227,10 @@ class PHPExcel_Calculation { $cellRef = $matches[6].$matches[7]; if ($matches[2] > '') { $matches[2] = trim($matches[2],"\"'"); + if ((strpos($matches[2],'[') !== false) || (strpos($matches[2],']') !== false)) { + // It's a Reference to an external workbook (not currently supported) + return $this->_raiseFormulaError('Unable to access External Workbook'); + } // echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'
'; $this->_writeDebug('Evaluating Cell '.$cellRef.' in worksheet '.$matches[2]); if (!is_null($pCellParent)) { diff --git a/changelog.txt b/changelog.txt index cbacf025..772db20f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -41,6 +41,7 @@ Fixed in SVN: - Bugfix: (MBaker) Work item 16212 - $arguments improperly used in CachedObjectStorage/PHPTemp.php - Bugfix: (MBaker) Work item 16643 - Bug In Cache System (cell reference when throwing caching errors) - Bugfix: (MBaker) Work item 16895 - PHP Invalid index notice on writing excel file when active sheet has been deleted +- Bugfix: (MBaker) Work item 16956 - External links in Excel2010 files cause Fatal error - General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC) - General: (MBaker) Work item 15461 - Locale file paths not fit for windows - General: (MBaker) Work item 16643 - Add file directory as a cache option for cache_to_discISAM