From 337af282335350ea4781d942d6053403bbc42751 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Tue, 14 Feb 2012 23:27:50 +0000 Subject: [PATCH] Prevent stack overflow problem when formula in a cell contains a named range without a worksheet reference... this doesn't fix the formula, but does avoid the exception and allows the workbook to be written with the problematic cell as a blank git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@86488 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Writer/Excel5/Parser.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Classes/PHPExcel/Writer/Excel5/Parser.php b/Classes/PHPExcel/Writer/Excel5/Parser.php index 5dc50c2..66a025b 100644 --- a/Classes/PHPExcel/Writer/Excel5/Parser.php +++ b/Classes/PHPExcel/Writer/Excel5/Parser.php @@ -1055,6 +1055,7 @@ class PHPExcel_Writer_Excel5_Parser while ($i < $formula_length) { $token .= $this->_formula{$i}; + if ($i < ($formula_length - 1)) { $this->_lookahead = $this->_formula{$i+1}; } else { @@ -1183,6 +1184,11 @@ class PHPExcel_Writer_Excel5_Parser { return $token; } + // It's an argument of some description (e.g. a named range), + // precise nature yet to be determined + elseif(substr($token,-1) == ')') { + return $token; + } return ''; } }