- Affected version
- 2.2.1
In
This can then cause the error;
When
XF\Service\Tag\Changer::removeTagsInternal
expects $removeTags
to be an array of TagContent
entities, but the caller (In XF\Service\Tag\Changer::removeTags
) only passes in an array of Tag
PHP:
public function removeTags($tagList, $ignoreNonRemovable = true)
{
if (!is_array($tagList))
{
$tagList = $this->splitTags($tagList);
}
$removeTags = $this->tagRepo->getTags($tagList);
$this->removeTagsInternal($removeTags, $ignoreNonRemovable);
}
protected function removeTagsInternal(array $removeTags, $ignoreNonRemovable = true)
{
$visitorUserId = \XF::visitor()->user_id;
foreach ($removeTags AS $tag)
{
if ($ignoreNonRemovable
&& !$this->getPermission('removeOthers')
&& $tag->add_user_id != $visitorUserId
)
{
// can't remove but told to ignore
continue;
}
...
This can then cause the error;
Code:
InvalidArgumentException: Accessed unknown getter 'add_user_id' on XF:Tag[10522]
When
$ignoreNonRemovable
is true (the default), and the user doesn't have permission to remove tags from others, it will error instead of ignore.