Merge pull request #11031 from MrPetovan/bug/9720-share-preg_replace

Escape dollar sign in replace string to prevent placeholder replacement in Model\Item::addShareDataFromOriginal
This commit is contained in:
Michael Vogel 2021-11-26 20:42:50 +01:00 committed by GitHub
commit b03b1fe367
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3354,7 +3354,7 @@ class Item
$body = $shared_item['body'];
}
$item['body'] = preg_replace("/\[share ([^\[\]]*)\].*\[\/share\]/ism", '[share $1]' . $body . '[/share]', $item['body']);
$item['body'] = preg_replace("/\[share ([^\[\]]*)\].*\[\/share\]/ism", '[share $1]' . str_replace('$', '\$', $body) . '[/share]', $item['body']);
unset($shared_item['body']);
return array_merge($item, $shared_item);