Additional regexp handling for UTF-8 strings

This commit is contained in:
MarkBaker 2015-02-15 00:01:01 +00:00
parent 518fbc1d36
commit 538fbcd2e8
2 changed files with 3 additions and 3 deletions

View File

@ -2920,11 +2920,11 @@ class PHPExcel_Calculation {
// echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />'; // echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function<br />';
if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) { if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
$val = preg_replace('/\s/','',$val); $val = preg_replace('/\s/u','',$val);
// echo 'Element '.$val.' is a Function<br />'; // echo 'Element '.$val.' is a Function<br />';
if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) { // it's a function if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) { // it's a function
$stack->push('Function', strtoupper($val)); $stack->push('Function', strtoupper($val));
$ax = preg_match('/^\s*(\s*\))/i', substr($formula, $index+$length), $amatch); $ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch);
if ($ax) { if ($ax) {
$stack->push('Operand Count for Function '.strtoupper($val).')', 0); $stack->push('Operand Count for Function '.strtoupper($val).')', 0);
$expectingOperator = TRUE; $expectingOperator = TRUE;

View File

@ -723,7 +723,7 @@ class PHPExcel_Helper_HTML
} }
protected function parseTextNode(DOMText $textNode) { protected function parseTextNode(DOMText $textNode) {
$domText = preg_replace('/\s+/', ' ', ltrim($textNode->nodeValue)); $domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue));
$this->stringData .= $domText; $this->stringData .= $domText;
$this->buildTextRun(); $this->buildTextRun();
} }