Skip to content

Commit

Permalink
fixes #4436 filter results in empty string if string to truncate cont…
Browse files Browse the repository at this point in the history
…ains the regex limiter "/"
  • Loading branch information
tsteur committed Jan 31, 2014
1 parent a361138 commit b0fb017
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/MobileMessaging/SMSProvider.php
Expand Up @@ -118,7 +118,7 @@ static public function truncate($string, $maximumNumberOfConcatenatedSMS, $appen
$subStrSize = self::sizeOfSMSContent($subStrToTruncate, $smsContentContainsUCS2Chars);
}

return preg_replace('/' . preg_quote($subStrToTruncate) . '$/', $appendedString, $string);
return preg_replace('/' . preg_quote($subStrToTruncate, '/') . '$/', $appendedString, $string);
}

static private function mb_str_split($string)
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPUnit/Integration/Plugins/MobileMessagingTest.php
Expand Up @@ -92,7 +92,7 @@ public function getTruncateTestCases()

$alternatedGSMx153 = str_repeat('a€', 153);

$GSMWithRegExpSpecialChars = $stdGSMx459 . '[\^$.|?*+()';
$GSMWithRegExpSpecialChars = $stdGSMx459 . '[\^$.|?*/+()';

$UCS2x201 = str_repeat('控', 201);

Expand Down Expand Up @@ -158,7 +158,7 @@ public function getTruncateTestCases()
array(str_repeat('控', 197) . $UCS2AppendedString, $UCS2x201 . '控', 3, $UCS2AppendedString),

// UCS-2, one '控' too many, appended with standard GSM characters
array(str_repeat('控', 193) . $stdGSMAppendedString, $UCS2x201 . '控', 3, $stdGSMAppendedString),
array(str_repeat('控', 193) . $stdGSMAppendedString, $UCS2x201 . '控', 3, $stdGSMAppendedString)
);
}

Expand Down

0 comments on commit b0fb017

Please sign in to comment.