From 9c99e5a91b388c205150f651ffd308939ab89a02 Mon Sep 17 00:00:00 2001 From: Xavier Noguer Gallego Date: Fri, 4 Jul 2003 08:53:53 +0000 Subject: [PATCH] fixing bug #24147, error parsing formula git-svn-id: https://svn.php.net/repository/pear/packages/Spreadsheet_Excel_Writer/trunk@134155 c90b9560-bf6c-de11-be94-00142212c4b1 --- Writer/Parser.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Writer/Parser.php b/Writer/Parser.php index b247cd0..a088cb1 100644 --- a/Writer/Parser.php +++ b/Writer/Parser.php @@ -1017,11 +1017,17 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR while ($i < strlen($this->_formula)) { $token .= $this->_formula{$i}; + if ($i < strlen($this->_formula) - 1) { + $this->_lookahead = $this->_formula{$i+1}; + } + else { + $this->_lookahead = ''; + } if ($this->_match($token) != '') { - if ($i < strlen($this->_formula) - 1) { - $this->_lookahead = $this->_formula{$i+1}; - } + //if ($i < strlen($this->_formula) - 1) { + // $this->_lookahead = $this->_formula{$i+1}; + //} $this->_current_char = $i + 1; $this->_current_token = $token; return 1; @@ -1130,7 +1136,8 @@ class Spreadsheet_Excel_Writer_Parser extends PEAR return $token; } // If it's a number (check that it's not a sheet name or range) - elseif (is_numeric($token) and !is_numeric($token.$this->_lookahead) and + elseif (is_numeric($token) and + (!is_numeric($token.$this->_lookahead)) or ($this->_lookahead == '')) and ($this->_lookahead != '!') and (($this->_lookahead != ':'))) { return $token;