From b0fb01781f2d509975dd58e535d7e5d9f103d599 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Fri, 31 Jan 2014 02:20:40 +0000 Subject: [PATCH] fixes #4436 filter results in empty string if string to truncate contains the regex limiter "/" --- plugins/MobileMessaging/SMSProvider.php | 2 +- tests/PHPUnit/Integration/Plugins/MobileMessagingTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/MobileMessaging/SMSProvider.php b/plugins/MobileMessaging/SMSProvider.php index a0b7081331e..7e8e7856712 100644 --- a/plugins/MobileMessaging/SMSProvider.php +++ b/plugins/MobileMessaging/SMSProvider.php @@ -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) diff --git a/tests/PHPUnit/Integration/Plugins/MobileMessagingTest.php b/tests/PHPUnit/Integration/Plugins/MobileMessagingTest.php index de288bba351..4bbb959f866 100644 --- a/tests/PHPUnit/Integration/Plugins/MobileMessagingTest.php +++ b/tests/PHPUnit/Integration/Plugins/MobileMessagingTest.php @@ -92,7 +92,7 @@ public function getTruncateTestCases() $alternatedGSMx153 = str_repeat('a€', 153); - $GSMWithRegExpSpecialChars = $stdGSMx459 . '[\^$.|?*+()'; + $GSMWithRegExpSpecialChars = $stdGSMx459 . '[\^$.|?*/+()'; $UCS2x201 = str_repeat('控', 201); @@ -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) ); }