]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #10187 from annando/notice
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sat, 1 May 2021 07:26:20 +0000 (09:26 +0200)
committerGitHub <noreply@github.com>
Sat, 1 May 2021 07:26:20 +0000 (09:26 +0200)
Fixes "PHP Notice:  Undefined variable: item in src/Model/Post/Media.php on line 561"

src/Model/Post/Media.php

index 89b5d37704dfa0926a0c32bd61046ca739623902..fe362f735848f8671f7a57037ef4ef16f816a27e 100644 (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];
                }