- Affected version
- 2.3.12
PHP:
/**
* @param $type
* @param bool $throw
*
* @return \XF\ApprovalQueue\AbstractHandler|null
*/
public function getApprovalQueueHandler($type, $throw = false)
...
public function getModeratorsWhoCanActionItem(
Entity $content,
bool $notifiableOnly = false
)
...
public function getModeratorsWhoCanActionItem(
Entity $content,
bool $notifiableOnly = false
)
{
$moderatorRepo = $this->repository(ModeratorRepository::class);
$moderators = $moderatorRepo
->findModeratorsForList()
->with('User.PermissionCombination')
->fetch();
if ($moderators->count())
{
/** @var \XF\ApprovalQueue\AbstractHandler $handler */
$handler = $this->getApprovalQueueHandler($content->getEntityContentType());
The explicit type hint on type hint on $handler is overriding that
getApprovalQueueHandler() can return null.This should be done at the start of the function and return if there is no handler instead of causing an internal server error;
Code:
Error: Call to a member function canView() on null in src/XF/Repository/ApprovalQueueRepository.php at line 239