• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Template error: Cannot call method getIp on a non-object

Affected version
XF2.0.0 RC 3

Fethi.dz

Active member
#1
Not sure what causing this error!!

Server error log
ErrorException: Template error: Cannot call method getIp on a non-object (NULL) src/XF/Template/Templater.php:907
Generated by: Fethi.dz Dec 6, 2017 at 10:57 PM
Stack trace
#0 [internal function]: XF\Template\Templater->handleTemplateError(512, 'Cannot call met...', '/home/xxxxxxx/...', 907, Array)
#1 src/XF/Template/Templater.php(907): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l3/s2/public/approval_item_user.php(25): XF\Template\Templater->method(NULL, 'getIp', Array)
#3 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#4 src/XF/ApprovalQueue/AbstractHandler.php(72): XF\Template\Templater->renderTemplate('public:approval...', Array)
#5 [internal function]: XF\ApprovalQueue\AbstractHandler->render(Object(XF\Entity\ApprovalQueue))
#6 src/XF/Template/Templater.php(920): call_user_func_array(Array, Array)
#7 internal_data/code_cache/templates/l3/s2/public/approval_queue.php(22): XF\Template\Templater->method(Object(XF\ApprovalQueue\User), 'render', Array)
#8 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#9 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('public:approval...', Array)
#10 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#11 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('XF:ApprovalQueu...', 'public:approval...', Array)
#12 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#14 src/XF/App.php(1863): XF\Mvc\Dispatcher->run()
#15 src/XF.php(328): XF\App->run()
#16 index.php(13): XF::runApp('XF\\Pub\\App')
#17 {main}
Request state
array(4) {
["url"] => string(21) "/demo/approval-queue/"
["referrer"] => string(25) "http://4algeria.com/demo/"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
 

Mike

XenForo developer
Staff member
#2
I believe this was reported via a ticket, but this has already been fixed. I don't see another public bug report for it though, so will tag this as fixed.
 
#3
Mike,
I am also having this exact same error several times. Should I report a ticket or do you have any more info on this.
Cannot call method getIp on a non-object (NULL) src/XF/Template/Templater.php:907
 

Mike

XenForo developer
Staff member
#4
We would need the full stack trace from that error to provide any guidance.

Note that this particular issue involved a template change, so if you have outdated templates (or aren't on 2.0.1), it could still happen.
 
#5
This is the latest. thanks.
Donnie

Code:
    ErrorException: Template error: Cannot call method getIp on a non-object (NULL) src/XF/Template/Templater.php:907

    Generated by: dbdriskell Dec 21, 2017 at 7:57 PM

Stack trace

#0 [internal function]: XF\Template\Templater->handleTemplateError(512, 'Cannot call met...', '/home/shipsofs/...', 907, Array)
#1 src/XF/Template/Templater.php(907): trigger_error('Cannot call met...', 512)
#2 internal_data/code_cache/templates/l1/s1/public/approval_item_user.php(25): XF\Template\Templater->method(NULL, 'getIp', Array)
#3 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#4 src/XF/ApprovalQueue/AbstractHandler.php(72): XF\Template\Templater->renderTemplate('public:approval...', Array)
#5 [internal function]: XF\ApprovalQueue\AbstractHandler->render(Object(XF\Entity\ApprovalQueue))
#6 src/XF/Template/Templater.php(920): call_user_func_array(Array, Array)
#7 internal_data/code_cache/templates/l1/s1/public/approval_queue.php(22): XF\Template\Templater->method(Object(XF\ApprovalQueue\User), 'render', Array)
#8 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#9 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('public:approval...', Array)
#10 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#11 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('XF:ApprovalQueu...', 'public:approval...', Array)
#12 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#14 src/XF/App.php(1879): XF\Mvc\Dispatcher->run()
#15 src/XF.php(328): XF\App->run()
#16 index.php(13): XF::runApp('XF\\Pub\\App')
#17 {main}

Request state

array(4) {
  ["url"] => string(34) "/xenforo/index.php?approval-queue/"
  ["referrer"] => string(41) "http://shipsofscale.com/xenforo/index.php"
  ["_GET"] => array(1) {
    ["approval-queue/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

Delete