Painbaker
Well-known member
- Affected version
- XF 2.3.0, XF 2.2.x
If a user has been deleted but their ip record persists for some reason, this will cause error when trying to view their shared IP addresses:
Code:
[E_WARNING] Undefined array key 22 in src\XF\Mvc\Entity\AbstractCollection.php at line 104
XF::handlePhpError() in src\XF\Mvc\Entity\AbstractCollection.php at line 104
XF\Mvc\Entity\AbstractCollection->offsetGet() in src\XF\Repository\IpRepository.php at line 185
XF\Repository\IpRepository->getSharedIpUsers() in src\XF\Entity\User.php at line 311
XF\Entity\User->getSharedIpUsers() in src\XF\Pub\Controller\MemberController.php at line 915
XF\Pub\Controller\MemberController->actionSharedIps() in src\XF\Mvc\Dispatcher.php at line 362
XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 265
XF\Mvc\Dispatcher->dispatchFromMatch() in src\XF\Mvc\Dispatcher.php at line 121
XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 63
XF\Mvc\Dispatcher->run() in src\XF\App.php at line 2777
XF\App->run() in src\XF.php at line 798
XF::runApp() in index.php at line 23
PHP:
$users = $this->em->findByIds('XF:User', array_keys($userIpLogs));
$output = [];
foreach ($ipLogs AS $ipLog)
{
$output[$ipLog['user_id']] = [
'user_id' => $ipLog['user_id'],
'user' => $users[$ipLog['user_id']], // <---
'ips' => $userIpLogs[$ipLog['user_id']]
];
}