mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix autoLink() when URLs contain email addresses.
Add whitespace lookbehind to ensure the email address is preceded by whitespace, this obviously means that emails starting with word/symbols are not detected, however those symbols are generally valid in an email address anyways, and will form the local part. Fixes #2403
This commit is contained in:
parent
bbe4c659aa
commit
7c66d0db50
1 changed files with 1 additions and 1 deletions
|
@ -187,7 +187,7 @@ class TextHelper extends AppHelper {
|
|||
|
||||
$atom = '[\p{L}0-9!#$%&\'*+\/=?^_`{|}~-]';
|
||||
$text = preg_replace_callback(
|
||||
'/(' . $atom . '+(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[\p{L}0-9-]+)+)/ui',
|
||||
'/(?<=\s)(' . $atom . '*(?:\.' . $atom . '+)*@[\p{L}0-9-]+(?:\.[\p{L}0-9-]+)+)/ui',
|
||||
array(&$this, '_insertPlaceholder'),
|
||||
$text
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue