diff --git a/Classes/PHPExcel/Calculation/TextData.php b/Classes/PHPExcel/Calculation/TextData.php index aceafc6..3c3ed22 100644 --- a/Classes/PHPExcel/Calculation/TextData.php +++ b/Classes/PHPExcel/Calculation/TextData.php @@ -239,9 +239,12 @@ class PHPExcel_Calculation_TextData { $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } - if (($offset > 0) && (strlen($haystack) > $offset)) { + if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) { + if (PHPExcel_Shared_String::CountCharacters($needle) == 0) { + return $offset; + } if (function_exists('mb_strpos')) { - $pos = mb_strpos($haystack, $needle, --$offset,'UTF-8'); + $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8'); } else { $pos = strpos($haystack, $needle, --$offset); } @@ -272,7 +275,10 @@ class PHPExcel_Calculation_TextData { $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE(); } - if (($offset > 0) && (strlen($haystack) > $offset)) { + if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) { + if (PHPExcel_Shared_String::CountCharacters($needle) == 0) { + return $offset; + } if (function_exists('mb_stripos')) { $pos = mb_stripos($haystack, $needle, --$offset,'UTF-8'); } else { diff --git a/changelog.txt b/changelog.txt index 6d0c51b..c8ab361 100644 --- a/changelog.txt +++ b/changelog.txt @@ -92,7 +92,7 @@ Fixed in develop branch: - Bugfix: (MBaker) Various fixes to Chart handling - Bugfix: (MBaker) Work item 18370 - Error loading xlsx file with column breaks - Bugfix: (MBaker) OOCalc Reader now handles percentage and currency data types -- Bugfix: (MBaker) OOCalc Reader modified to process number-rows-repeated +- Bugfix: (MBaker) Work Item 18415- mb_stripos empty delimiter 2012-05-19 (v1.7.7): diff --git a/unitTests/rawTestData/Calculation/TextData/FIND.data b/unitTests/rawTestData/Calculation/TextData/FIND.data index 677d4f0..411150d 100644 --- a/unitTests/rawTestData/Calculation/TextData/FIND.data +++ b/unitTests/rawTestData/Calculation/TextData/FIND.data @@ -9,3 +9,5 @@ "k", "Mark Baker", 5, 8 "a", "Mark Baker", 3, 7 "BITE", "BIT", "#VALUE!" +"", "Mark Baker", 1 +"", "Mark Baker", 8, 8