diff options
| -rw-r--r-- | phpBB/includes/functions.php | 3 | ||||
| -rw-r--r-- | phpBB/includes/functions_content.php | 2 | ||||
| -rw-r--r-- | tests/text_processing/decode_message_test.php | 17 |
3 files changed, 20 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c4f285c905..10788d0d6a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2746,7 +2746,8 @@ function get_preg_expression($mode) return array( '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#', '#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&|\?)sid=[0-9a-f]{32})?">.*?</a><!\-\- l \-\->#', - '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">(.*?)</a><!\-\- \1 \-\->#', + '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="http://(.*?)">\2</a><!\-\- \1 \-\->#', + '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->#', '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#', '#<!\-\- .*? \-\->#s', '#<.*?>#s', diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 39a3f0352f..df4a51db98 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -469,7 +469,7 @@ function decode_message(&$message, $bbcode_uid = '') $message = str_replace($match, $replace, $message); $match = get_preg_expression('bbcode_htm'); - $replace = array('\1', '\1', '\3', '\1', '', ''); + $replace = array('\1', '\1', '\2', '\2', '\1', '', ''); $message = preg_replace($match, $replace, $message); } diff --git a/tests/text_processing/decode_message_test.php b/tests/text_processing/decode_message_test.php index 7de599f2b1..fd1719fedc 100644 --- a/tests/text_processing/decode_message_test.php +++ b/tests/text_processing/decode_message_test.php @@ -16,6 +16,15 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; class phpbb_text_processing_decode_message_test extends phpbb_test_case { + public function setUp() + { + parent::setUp(); + + global $phpbb_dispatcher; + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + } + /** * @dataProvider get_legacy_tests */ @@ -46,6 +55,14 @@ class phpbb_text_processing_decode_message_test extends phpbb_test_case '<!-- m --><a class="postlink" href="http://www.phpbb.com">http://www.phpbb.com</a><!-- m -->', 'http://www.phpbb.com' ), + array( + '<!-- m --><a class="postlink" href="http://www.phpbb.com">this is just text</a><!-- m -->', + 'http://www.phpbb.com' + ), + array( + '<!-- m --><a class="postlink" href="http://www.phpbb.com/some/more/link/that/is/shortened">http://www.phpbb.com/some/ ... /shortened</a><!-- m -->', + 'http://www.phpbb.com/some/more/link/that/is/shortened' + ), /** * Fails as per PHPBB3-8420 * @link http://tracker.phpbb.com/browse/PHPBB3-8420 |
