Fixed Thread Reply Ban Alerts + Push: Template error: [E_WARNING] Attempt to read property "prefix_id" on null

Steffen

Well-known member
Affected version
2.2.5
The templates "alert_thread_reply_ban" and "push_thread_reply_ban" both try to pass a variable named $thread to the "prefix" template function. This variable doesn't exist. It's called $content.

I'm not sure why this error has started to appear now. Maybe related to XenForo 2.2.5 or PHP 8 (my guess is the latter because there don't seem to be changes related to thread reply bans in XenForo 2.2.5).

Code:
#0 src/XF/Template/Templater.php(3476): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] Att...', '/data/www/basec...', 3476)
#1 [internal function]: XF\Template\Templater->fnPrefix(Object(XF\Template\Templater), true, 'thread', NULL)
#2 src/XF/Template/Templater.php(1108): call_user_func_array(Array, Array)
#3 /data/www/xenforo-code-cache/templates/l2/s2/public/alert_thread_reply_ban.php(9): XF\Template\Templater->func('prefix', Array, true)
#4 src/XF/Template/Templater.php(1631): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#5 src/XF/Alert/AbstractHandler.php(80): XF\Template\Templater->renderTemplate('alert_thread_re...', Array)
#6 src/XF/Entity/UserAlert.php(71): XF\Alert\AbstractHandler->render(Object(XF\Entity\UserAlert))
#7 [internal function]: XF\Entity\UserAlert->render()
#8 src/XF/Template/Templater.php(1171): call_user_func_array(Array, Array)
#9 /data/www/xenforo-code-cache/templates/l2/s2/public/alert_macros.php(19): XF\Template\Templater->method(Object(XF\Entity\UserAlert), 'render', Array)
#10 src/XF/Template/Templater.php(804): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#11 /data/www/xenforo-code-cache/templates/l2/s2/public/account_alerts_popup.php(17): XF\Template\Templater->callMacro('alert_macros', 'row', Array, Array)
#12 src/XF/Template/Templater.php(1631): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, NULL)
#13 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('account_alerts_...', Array)
#14 src/XF/Mvc/Renderer/Json.php(84): XF\Template\Template->render()
#15 src/XF/Mvc/Renderer/Json.php(68): XF\Mvc\Renderer\Json->renderHtmlFallback('XF:Account\\Aler...', 'public:account_...', Array)
#16 src/XF/Mvc/Dispatcher.php(458): XF\Mvc\Renderer\Json->renderView('XF:Account\\Aler...', 'public:account_...', Array)
#17 src/XF/Mvc/Dispatcher.php(440): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#18 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#19 src/XF/Mvc/Dispatcher.php(58): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#20 src/XF/App.php(2367): XF\Mvc\Dispatcher->run()
#21 src/XF.php(497): XF\App->run()
#22 index.php(20): XF::runApp('XF\\Pub\\App')
#23 {main}
 
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.6).

Change log:
Fix prefix function usage in alert/push_thread_reply_ban templates.
There may be a delay before changes are rolled out to the XenForo Community.
 


Write your reply...
Back
Top Bottom