@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make `#🐳` work properly

Summary:
Ref T6223. Two issues:

- We don't use `/u` mode on these regexps. Without `/u`, the `\w`/`\W`/`\s`/`\S` modifiers have bad behavior on non-ASCII bytes. Add the flag to use unicode mode, making `\w` and `\s` behave like we expect.
- We might possibly want to do something different here eventually (for example, if the `/u` flag has some huge performance penalty) but this seems OK for now.
- We use `\b` (word boundary) to terminate the match, but `🐳` is not a word character. Use `(?!\w)` instead ("don't match before a word character") which is what we mean.

Test Plan: {F211498}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T6223

Differential Revision: https://secure.phabricator.com/D10618

+2 -2
+2 -2
src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
··· 100 100 $id = $this->getObjectIDPattern(); 101 101 102 102 $text = preg_replace_callback( 103 - '@\B{'.$prefix.'('.$id.')((?:[^}\\\\]|\\\\.)*)}\B@', 103 + '@\B{'.$prefix.'('.$id.')((?:[^}\\\\]|\\\\.)*)}\B@u', 104 104 array($this, 'markupObjectEmbed'), 105 105 $text); 106 106 ··· 122 122 // in the middle of words. 123 123 124 124 $text = preg_replace_callback( 125 - '((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)', 125 + '((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?(?!\w))u', 126 126 array($this, 'markupObjectReference'), 127 127 $text); 128 128