From 538fbcd2e807c14609ade41cad0b4ecf33355d84 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sun, 15 Feb 2015 00:01:01 +0000 Subject: [PATCH] Additional regexp handling for UTF-8 strings --- Classes/PHPExcel/Calculation.php | 4 ++-- Classes/PHPExcel/Helper/HTML.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index 1b010163..48fb4a42 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -2920,11 +2920,11 @@ class PHPExcel_Calculation { // echo 'Element with value '.$val.' is an Operand, Variable, Constant, String, Number, Cell Reference or Function
'; 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
'; if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) { // it's a function $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) { $stack->push('Operand Count for Function '.strtoupper($val).')', 0); $expectingOperator = TRUE; diff --git a/Classes/PHPExcel/Helper/HTML.php b/Classes/PHPExcel/Helper/HTML.php index 48845aea..9e30ae8a 100644 --- a/Classes/PHPExcel/Helper/HTML.php +++ b/Classes/PHPExcel/Helper/HTML.php @@ -723,7 +723,7 @@ class PHPExcel_Helper_HTML } protected function parseTextNode(DOMText $textNode) { - $domText = preg_replace('/\s+/', ' ', ltrim($textNode->nodeValue)); + $domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue)); $this->stringData .= $domText; $this->buildTextRun(); }