diff --git a/CHANGELOG.md b/CHANGELOG.md index b7c2ceff..3d8cbad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). - Keep big integer as integer instead of lossely casting to float [#874](https://github.com/PHPOffice/PhpSpreadsheet/pull/874) - Fix branch pruning handling of non boolean conditions [#1167](https://github.com/PHPOffice/PhpSpreadsheet/pull/1167) - Fix ODS Reader when no DC namespace are defined [#1182](https://github.com/PHPOffice/PhpSpreadsheet/pull/1182) +- Fixed Functions->ifCondition for allowing <> and empty condition [#1206](https://github.com/PHPOffice/PhpSpreadsheet/pull/1206) ## [1.9.0] - 2019-08-17 diff --git a/src/PhpSpreadsheet/Calculation/Functions.php b/src/PhpSpreadsheet/Calculation/Functions.php index 40e7d964..38bd87c6 100644 --- a/src/PhpSpreadsheet/Calculation/Functions.php +++ b/src/PhpSpreadsheet/Calculation/Functions.php @@ -278,7 +278,7 @@ class Functions $condition = Calculation::wrapResult(strtoupper($condition)); } - return '=' . $condition; + return str_replace('""""', '""', '=' . $condition); } preg_match('/(=|<[>=]?|>=?)(.*)/', $condition, $matches); [, $operator, $operand] = $matches; @@ -290,7 +290,7 @@ class Functions $operand = Calculation::wrapResult(strtoupper($operand)); } - return $operator . $operand; + return str_replace('""""', '""', $operator . $operand); } /** diff --git a/tests/data/Calculation/Functions/IF_CONDITION.php b/tests/data/Calculation/Functions/IF_CONDITION.php index 0b510ed9..0ac81d5d 100644 --- a/tests/data/Calculation/Functions/IF_CONDITION.php +++ b/tests/data/Calculation/Functions/IF_CONDITION.php @@ -33,4 +33,12 @@ return [ '<>"< PLEASE SELECT >"', '<>< Please Select >', ], + [ + '<>""', + '<>', + ], + [ + '=""', + '""', + ], ];