Merge pull request #10187 from annando/notice

Fixes "PHP Notice:  Undefined variable: item in src/Model/Post/Media.php on line 561"
This commit is contained in:
Tobias Diekershoff 2021-05-01 09:26:20 +02:00 committed by GitHub
commit cea00f5f75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -538,6 +538,8 @@ class Media
}
$body = $item['body'];
}
$original_body = $body;
$body = preg_replace("/\s*\[attachment .*?\].*?\[\/attachment\]\s*/ism", '', $body);
foreach (self::getByURIId($uriid, [self::IMAGE, self::AUDIO, self::VIDEO]) as $media) {
@ -558,7 +560,7 @@ class Media
}
}
if (preg_match("/.*(\[attachment.*?\].*?\[\/attachment\]).*/ism", $item['body'], $match)) {
if (preg_match("/.*(\[attachment.*?\].*?\[\/attachment\]).*/ism", $original_body, $match)) {
$body .= "\n" . $match[1];
}