Merge pull request #9248 from annando/fatal

Avoid fatal error on the community page
This commit is contained in:
Tobias Diekershoff 2020-09-20 19:56:47 +02:00 committed by GitHub
commit 886cd9a357
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -142,6 +142,10 @@ class PageInfo
$text .= " title='" . $data['title'] . "'"; $text .= " title='" . $data['title'] . "'";
} }
if (empty($data['text'])) {
$data['text'] = '';
}
// Only embedd a picture link when it seems to be a valid picture ("width" is set) // Only embedd a picture link when it seems to be a valid picture ("width" is set)
if (!empty($data['images']) && !empty($data['images'][0]['width'])) { if (!empty($data['images']) && !empty($data['images'][0]['width'])) {
$preview = str_replace(['[', ']'], ['[', ']'], htmlentities($data['images'][0]['src'], ENT_QUOTES, 'UTF-8', false)); $preview = str_replace(['[', ']'], ['[', ']'], htmlentities($data['images'][0]['src'], ENT_QUOTES, 'UTF-8', false));
@ -163,7 +167,7 @@ class PageInfo
} }
} }
$text .= ']' . $data['text'] ?? '' . '[/attachment]'; $text .= ']' . $data['text'] . '[/attachment]';
$hashtags = ''; $hashtags = '';
if (!empty($data['keywords'])) { if (!empty($data['keywords'])) {

View File

@ -977,7 +977,7 @@ class Post
if ($this->isToplevel()) { if ($this->isToplevel()) {
if ($conv->getMode() !== 'profile') { if ($conv->getMode() !== 'profile') {
if ($this->getDataValue('wall') && !$this->getDataValue('self')) { if ($this->getDataValue('wall') && !$this->getDataValue('self') && !empty($a->page_contact)) {
// On the network page, I am the owner. On the display page it will be the profile owner. // On the network page, I am the owner. On the display page it will be the profile owner.
// This will have been stored in $a->page_contact by our calling page. // This will have been stored in $a->page_contact by our calling page.
// Put this person as the wall owner of the wall-to-wall notice. // Put this person as the wall owner of the wall-to-wall notice.