BBCode - optimized preg escaping of searchstring

2022.09-rc
Peter Liebetrau 2019-01-25 16:56:28 +01:00
rodzic 6ba08e510d
commit 71e58a0f42
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -1363,7 +1363,7 @@ class BBCode extends BaseObject
// We need no target="_blank" for local links
// convert links start with System::baseUrl() as local link without the target="_blank" attribute
$escapedBaseUrl = str_replace('://', '\:\/\/', System::baseUrl());
$escapedBaseUrl = preg_quote(System::baseUrl(), '/');
$text = preg_replace("/\[url\]($escapedBaseUrl)([$URLSearchString]*)\[\/url\]/ism", '<a href="$1$2">$1$2</a>', $text);
$text = preg_replace("/\[url\=($escapedBaseUrl)([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1$2">$3</a>', $text);