From 837dc9b3a737e68d12eef033572894a81a2c0de7 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Wed, 6 Sep 2017 03:35:26 +0200 Subject: [PATCH] [ticket/15348] Ignore smilies that are immediately followed by a word PHPBB3-15348 --- phpBB/phpbb/textformatter/s9e/factory.php | 3 ++ .../tickets_data/PHPBB3-15348.html | 1 + .../tickets_data/PHPBB3-15348.txt | 1 + .../tickets_data/PHPBB3-15348.xml | 33 +++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 tests/text_processing/tickets_data/PHPBB3-15348.html create mode 100644 tests/text_processing/tickets_data/PHPBB3-15348.txt create mode 100644 tests/text_processing/tickets_data/PHPBB3-15348.xml diff --git a/phpBB/phpbb/textformatter/s9e/factory.php b/phpBB/phpbb/textformatter/s9e/factory.php index 7719ce5afa..3f2e0ab8cb 100644 --- a/phpBB/phpbb/textformatter/s9e/factory.php +++ b/phpBB/phpbb/textformatter/s9e/factory.php @@ -323,6 +323,9 @@ class factory implements \phpbb\textformatter\cache_interface // Only parse emoticons at the beginning of the text or if they're preceded by any // one of: a new line, a space, a dot, or a right square bracket $configurator->Emoticons->notAfter = '[^\\n .\\]]'; + + // Ignore emoticons that are immediately followed by a "word" character + $configurator->Emoticons->notBefore = '\\w'; } // Load the censored words diff --git a/tests/text_processing/tickets_data/PHPBB3-15348.html b/tests/text_processing/tickets_data/PHPBB3-15348.html new file mode 100644 index 0000000000..e65925ec28 --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-15348.html @@ -0,0 +1 @@ +:o k: :ok: \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-15348.txt b/tests/text_processing/tickets_data/PHPBB3-15348.txt new file mode 100644 index 0000000000..d6b971702c --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-15348.txt @@ -0,0 +1 @@ +:o k: :ok: \ No newline at end of file diff --git a/tests/text_processing/tickets_data/PHPBB3-15348.xml b/tests/text_processing/tickets_data/PHPBB3-15348.xml new file mode 100644 index 0000000000..0c88c8824f --- /dev/null +++ b/tests/text_processing/tickets_data/PHPBB3-15348.xml @@ -0,0 +1,33 @@ + + + + smiley_id + code + emotion + smiley_url + smiley_width + smiley_height + smiley_order + display_on_posting + + 13 + :o + First half of :ok: + icon_e_surprised.gif + 15 + 17 + 14 + 1 + + + 99 + k: + Second half of :ok: + icon_lol.gif + 15 + 17 + 22 + 1 + +
+