Fixed InvalidArgumentException: Accessed unknown getter 'ProfileUser'

Fethi.dz

Well-known member
Affected version
2.0.0 RC 2
Hi,

This error happened when a user have some alerts new/old and I change the user name to a different name.

I can see that some alerts didn’t update the user name to the new one and from that the error is generated.

InvalidArgumentException: Accessed unknown getter 'ProfileUser' on XF:User[2] src/XF/Mvc/Entity/Entity.php:179
Generated by: Test33 Nov 22, 2017 at 8:51 AM
Stack trace
#0 src/XF/Mvc/Entity/Entity.php(97): XF\Mvc\Entity\Entity->get('ProfileUser')
#1 internal_data/code_cache/templates/l3/s2/public/alert_user_profile_post_edit.php(6): XF\Mvc\Entity\Entity->offsetGet('ProfileUser')
#2 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#3 src/XF/Alert/AbstractHandler.php(67): XF\Template\Templater->renderTemplate('public:alert_us...', Array)
#4 src/XF/Entity/UserAlert.php(67): XF\Alert\AbstractHandler->render(Object(XF\Entity\UserAlert))
#5 [internal function]: XF\Entity\UserAlert->render()
#6 src/XF/Template/Templater.php(920): call_user_func_array(Array, Array)
#7 internal_data/code_cache/templates/l3/s2/public/alert_macros.php(18): XF\Template\Templater->method(Object(XF\Entity\UserAlert), 'render', Array)
#8 src/XF/Template/Templater.php(643): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, Array)
#9 internal_data/code_cache/templates/l3/s2/public/account_alerts.php(28): XF\Template\Templater->callMacro('alert_macros', 'row', Array, Array)
#10 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#11 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('public:account_...', Array)
#12 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#13 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('XF:Account\\Aler...', 'public:account_...', Array)
#14 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#15 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#16 src/XF/App.php(1863): XF\Mvc\Dispatcher->run()
#17 src/XF.php(328): XF\App->run()
#18 index.php(13): XF::runApp('XF\\Pub\\App')
#19 {main}
Request state
array(4) {
["url"] => string(20) "/demo/account/alerts"
["referrer"] => string(50) "http://4algeria.com/demo/whats-new/latest-activity"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
There was actually an invalid reference to a value in the template so that should be fixed now for the next release, thank you.
 
Hello Chris,

I just updated my XF2.0 to RC3, in the alers list, the alert phrase doesn't triger the new user name, the old name still there. Is this normal behaviour to keep old name in the alers instead updating them with the new user name!!!
 
Actually in this case, yes. This type of alert (specifically moderator action alerts on profile posts) has a bunch of cached data which isn't really possible to update. This would have been the same in XF1.
 
Top Bottom