From: Michael Date: Fri, 6 Apr 2018 09:11:10 +0000 (+0000) Subject: Fixes warning "missing terminating ] for character class" X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8d68e865c1177bcf8aabb2a03ab54bb38b476b5f;p=friendica.git Fixes warning "missing terminating ] for character class" --- diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 7615ab08a8..97b8092118 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -242,9 +242,10 @@ class BBCode extends BaseObject // Simplify image codes $body = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $body); + $URLSearchString = "^\[\]"; + $body = preg_replace("/\[img\=([$URLSearchString]*)\](.*?)\[\/img\]/ism", '[img]$1[/img]', $body); - $URLSearchString = "^\[\]"; if (preg_match_all("(\[url=([$URLSearchString]*)\]\s*\[img\]([$URLSearchString]*)\[\/img\]\s*\[\/url\])ism", $body, $pictures, PREG_SET_ORDER)) { if ((count($pictures) == 1) && !$has_title) { // Checking, if the link goes to a picture