RSS Feed/News \XF\Entity\Thread::getCoverUrl() may cause undefined array key

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
24,814
Points
823

Reputation:

XF\Entity\CoverImageTrait::getCoverImageInternal()

PHP:

Code:
/** @var Attachment $attachment */
if ($embeddedAttachments[$attachment->attachment_id])
{
    continue;
}

This calls \XF\Mvc\AbstractCollection::offsetGet()
PHP:

Code:
public function offsetGet($key): ?Entity
{
    return $this->entities[$key];
}

As can be seen, this directly accesses the internal array without checking if the key exists, so if it does not exist this generates a warning Undefined array key ......

Read more

Continue reading...
 
Status
Not open for further replies.
Top