From 48b2fb8e994b95d44a4bcf55678cc02686efb826 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Sun, 15 May 2011 22:58:20 +0000 Subject: [PATCH] Bugfix: Locale-specific fix to text functions when passing a boolean argument instead of a string git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@73499 2327b42d-5241-43d6-9e2a-de5ac946f064 --- Classes/PHPExcel/Calculation/TextData.php | 32 +++++++++-------------- changelog.txt | 1 + 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Classes/PHPExcel/Calculation/TextData.php b/Classes/PHPExcel/Calculation/TextData.php index 42ac59c5..2e676fc3 100644 --- a/Classes/PHPExcel/Calculation/TextData.php +++ b/Classes/PHPExcel/Calculation/TextData.php @@ -96,7 +96,7 @@ class PHPExcel_Calculation_TextData { $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue); if (is_bool($stringValue)) { - $stringValue = ($stringValue) ? 'TRUE' : 'FALSE'; + $stringValue = ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (self::$_invalidChars == Null) { @@ -138,11 +138,7 @@ class PHPExcel_Calculation_TextData { if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $characters = (int) $characters; } else { - if ($characters) { - $characters = 'True'; - } else { - $characters = 'False'; - } + $characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } } @@ -173,11 +169,7 @@ class PHPExcel_Calculation_TextData { if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) { $arg = (int) $arg; } else { - if ($arg) { - $arg = 'TRUE'; - } else { - $arg = 'FALSE'; - } + $arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } } $returnValue .= $arg; @@ -238,7 +230,7 @@ class PHPExcel_Calculation_TextData { if (!is_bool($needle)) { if (is_bool($haystack)) { - $haystack = ($haystack) ? 'TRUE' : 'FALSE'; + $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (($offset > 0) && (strlen($haystack) > $offset)) { @@ -271,7 +263,7 @@ class PHPExcel_Calculation_TextData { if (!is_bool($needle)) { if (is_bool($haystack)) { - $haystack = ($haystack) ? 'TRUE' : 'FALSE'; + $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (($offset > 0) && (strlen($haystack) > $offset)) { @@ -326,7 +318,7 @@ class PHPExcel_Calculation_TextData { } if (is_bool($value)) { - $value = ($value) ? 'TRUE' : 'FALSE'; + $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (function_exists('mb_substr')) { @@ -355,7 +347,7 @@ class PHPExcel_Calculation_TextData { } if (is_bool($value)) { - $value = ($value) ? 'TRUE' : 'FALSE'; + $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (function_exists('mb_substr')) { @@ -382,7 +374,7 @@ class PHPExcel_Calculation_TextData { } if (is_bool($value)) { - $value = ($value) ? 'TRUE' : 'FALSE'; + $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) { @@ -404,7 +396,7 @@ class PHPExcel_Calculation_TextData { $value = PHPExcel_Calculation_Functions::flattenSingleValue($value); if (is_bool($value)) { - $value = ($value) ? 'TRUE' : 'FALSE'; + $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (function_exists('mb_strlen')) { @@ -427,7 +419,7 @@ class PHPExcel_Calculation_TextData { $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); if (is_bool($mixedCaseString)) { - $mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE'; + $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (function_exists('mb_convert_case')) { @@ -450,7 +442,7 @@ class PHPExcel_Calculation_TextData { $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); if (is_bool($mixedCaseString)) { - $mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE'; + $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (function_exists('mb_convert_case')) { @@ -473,7 +465,7 @@ class PHPExcel_Calculation_TextData { $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString); if (is_bool($mixedCaseString)) { - $mixedCaseString = ($mixedCaseString) ? 'TRUE' : 'FALSE'; + $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } if (function_exists('mb_convert_case')) { diff --git a/changelog.txt b/changelog.txt index d48f107d..14d6aebe 100644 --- a/changelog.txt +++ b/changelog.txt @@ -34,6 +34,7 @@ Fixed in SVN: - Bugfix: (gilles06) Work item 15707 - ini_set() call in Calculation class destructor - Bugfix: (MBaker) Work item 15786 - RangeToArray strange array keys - Bugfix: (MBaker) Work item 15762 - INDIRECT() function doesn't work with named ranges +- Bugfix: (MBaker) Locale-specific fix to text functions when passing a boolean argument instead of a string - General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC) - General: (MBaker) Work item 15461 - Locale file paths not fit for windows