1
1
Fork 0

Merge pull request #4758 from annando/fix-regexp

Fixes warning "missing terminating ] for character class"
This commit is contained in:
Tobias Diekershoff 2018-04-06 11:13:42 +02:00 committed by GitHub
commit f0590145b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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