Bugfix: Work Item 18415- mb_stripos empty delimiter

This commit is contained in:
Mark Baker
2012-07-27 22:06:28 +01:00
parent 8ab0200584
commit 8f3dc270a6
3 changed files with 12 additions and 4 deletions
+9 -3
View File
@@ -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 {