]> git.mxchange.org Git - friendica.git/commitdiff
Use preg_quote
authorMichael <heluecht@pirati.ca>
Wed, 23 Sep 2020 15:28:00 +0000 (15:28 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 23 Sep 2020 15:28:00 +0000 (15:28 +0000)
src/Protocol/ActivityPub/Processor.php

index f181e70c6ccaaa5db8cac1cb7f6d8c85c1659489..7026d18dac6b25334a64aeb2ce2513c297e77bb8 100644 (file)
@@ -856,7 +856,7 @@ class Processor
                        }
                        // We check with "strpos" for performance issues. Only when this is true, the regular expression check is used
                        // RegExp is taken from here: https://medium.com/@shiba1014/regex-word-boundaries-with-unicode-207794f6e7ed
-                       if ((strpos($content, $tag) !== false) && preg_match('/(?<=[\s,.:;"\']|^)' . $tag . '(?=[\s,.:;"\']|$)/', $content)) {
+                       if ((strpos($content, $tag) !== false) && preg_match('/(?<=[\s,.:;"\']|^)' . preg_quote($tag) . '(?=[\s,.:;"\']|$)/', $content)) {
                                Logger::info('Subscribed hashtag found in content - accepted', ['id' => $id, 'hashtag' => $tag]);
                                return true;
                        }