Fixed ErrorException: Argument 1 passed to XenForo_Model_User::canWarnUser() must be of the type array, nu

Carla Birch

Well-known member
Hi,

I'm testing the 1.3 beta on my local test install and it installs fine, but once i login the front end i get white page with An unexpected error occurred. Please try again later.

Checking the admin error log i get the following errors:

PHP:
ErrorException: Argument 1 passed to XenForo_Model_User::canWarnUser() must be of the type array, null given, called in /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ReportHandler/User.php on line 49 and defined - library/XenForo/Model/User.php:2178
Generated By: C.Birch, 1 min ago
Stack Trace

#0 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/Model/User.php(2178): XenForo_Application::handlePhpError(4096, 'Argument 1 pass...', '/Applications/X...', 2178, Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ReportHandler/User.php(49): XenForo_Model_User->canWarnUser(NULL, NULL, Array)
#2 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/Model/Report.php(184): XenForo_ReportHandler_User->getVisibleReportsForUser(Array, Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/Model/Report.php(273): XenForo_Model_Report->getVisibleReportsForUser(Array, Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ControllerPublic/Abstract.php(389): XenForo_Model_Report->getActiveReportsCountsForUser()
#5 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ControllerPublic/Abstract.php(357): XenForo_ControllerPublic_Abstract->_updateModeratorSessionReportCounts()
#6 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ControllerPublic/Abstract.php(30): XenForo_ControllerPublic_Abstract->_updateModeratorSessionCaches()
#7 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/Controller.php(308): XenForo_ControllerPublic_Abstract->_preDispatchType('Index')
#8 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/FrontController.php(346): XenForo_Controller->preDispatch('Index', 'XenForo_Control...')
#9 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#10 /Applications/XAMPP/xamppfiles/htdocs/forums/index.php(13): XenForo_FrontController->run()
#11 {main}

Request State

array(3) {
  ["url"] => string(24) "http://localhost/forums/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

PHP:
ErrorException: Undefined index: user - library/XenForo/ReportHandler/User.php:49
Generated By: C.Birch, 2 min ago
Stack Trace

#0 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ReportHandler/User.php(49): XenForo_Application::handlePhpError(8, 'Undefined index...', '/Applications/X...', 49, Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/Model/Report.php(184): XenForo_ReportHandler_User->getVisibleReportsForUser(Array, Array)
#2 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/Model/Report.php(273): XenForo_Model_Report->getVisibleReportsForUser(Array, Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ControllerPublic/Abstract.php(389): XenForo_Model_Report->getActiveReportsCountsForUser()
#4 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ControllerPublic/Abstract.php(357): XenForo_ControllerPublic_Abstract->_updateModeratorSessionReportCounts()
#5 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/ControllerPublic/Abstract.php(30): XenForo_ControllerPublic_Abstract->_updateModeratorSessionCaches()
#6 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/Controller.php(308): XenForo_ControllerPublic_Abstract->_preDispatchType('Errorserver')
#7 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/FrontController.php(346): XenForo_Controller->preDispatch('Errorserver', 'XenForo_Control...')
#8 /Applications/XAMPP/xamppfiles/htdocs/forums/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /Applications/XAMPP/xamppfiles/htdocs/forums/index.php(13): XenForo_FrontController->run()
#10 {main}

Request State

array(3) {
  ["url"] => string(24) "http://localhost/forums/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Is this a fresh install or an upgrade? If it's an upgrade, did you have any add-ons installed before? (Particularly one that allowed users to be reported.)
 
Did you ever have an add-on that allowed users to be reported? It certainly looks like that's what's causing this. The code just needs to be more resilient I think.
 
That must be from an add-on, as it appears that was reported in November. (Reporting a user is new in 1.3.)
 
That must be from an add-on, as it appears that was reported in November. (Reporting a user is new in 1.3.)
Yep it's from a add-on, 1 i no longer seem to have installed because the reports no longer in the closed reports, trying to find out what add-on it was from so it can help others who might get same problem.
 
I've made the code handle this a bit better, though note that entries made with the add-on are effectively "corrupt" in terms of our code, so they won't function as expected.
 
Top Bottom