mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
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
This commit is contained in:
parent
0a6473138f
commit
fda0b086b5
1 changed files with 2 additions and 2 deletions
|
@ -100,7 +100,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
|
||||||
$id = $this->getObjectIDPattern();
|
$id = $this->getObjectIDPattern();
|
||||||
|
|
||||||
$text = preg_replace_callback(
|
$text = preg_replace_callback(
|
||||||
'@\B{'.$prefix.'('.$id.')((?:[^}\\\\]|\\\\.)*)}\B@',
|
'@\B{'.$prefix.'('.$id.')((?:[^}\\\\]|\\\\.)*)}\B@u',
|
||||||
array($this, 'markupObjectEmbed'),
|
array($this, 'markupObjectEmbed'),
|
||||||
$text);
|
$text);
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
|
||||||
// in the middle of words.
|
// in the middle of words.
|
||||||
|
|
||||||
$text = preg_replace_callback(
|
$text = preg_replace_callback(
|
||||||
'((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)',
|
'((?<![#-])'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?(?!\w))u',
|
||||||
array($this, 'markupObjectReference'),
|
array($this, 'markupObjectReference'),
|
||||||
$text);
|
$text);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue