Fixed XF\Api\Controller\Alert :: assertViewableAlert has two coding errors

DragonByte Tech

Well-known member
Affected version
This block of code:
        if ($alert->alerted_user_id != \XF::visitor()->user_id)
            throw $this->notFound();

        if (!$alert->canView())
            throw $this->noPermission();

Produces hard errors when viewed in phpStorm:



From what I can tell, phpStorm is accurate in its analysis. I believe both notFound and noPermission should be surrounded by $this->exception().

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.2).

Change log:
Throw exceptions correctly in the alert API controller.
There may be a delay before changes are rolled out to the XenForo Community.