From 6f7e063b3457888a2a6faad684b6cd4d1c8b28b3 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 1 May 2021 07:10:27 +0000 Subject: [PATCH] Fixes "PHP Notice: Undefined variable: item in src/Model/Post/Media.php on line 561" --- src/Model/Post/Media.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Model/Post/Media.php b/src/Model/Post/Media.php index 89b5d3770..fe362f735 100644 --- a/src/Model/Post/Media.php +++ b/src/Model/Post/Media.php @@ -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]; }