Intermittent undefined index errors, e.g. Undefined index: user_id when XenForo_Visitor is used.

The Sandman

Well-known member
That's rather odd. It's a default XenForo field which should be assigned 0 for guests even. That one you copied is for an "Unknown Account", is it always that?

Here's another one - they come hundreds at a time:
Code:
Error Info
ErrorException: Undefined index: user_id - library/XenForo/Visitor.php:670
Generated By: Unknown Account, Today at 7:07 AM
Stack Trace
#0 /srv/www/theadminzone.com/public_html/library/XenForo/Visitor.php(670): XenForo_Application::handlePhpError(8, 'Undefined index...', '/srv/www/theadm...', 670, Array)
#1 /srv/www/theadminzone.com/public_html/library/XenForo/Visitor.php(113): XenForo_Visitor->offsetGet('user_id')
#2 /srv/www/theadminzone.com/public_html/library/Bookmarks/Listener/Hook.php(10): XenForo_Visitor::getUserId()
#3 [internal function]: Bookmarks_Listener_Hook::templateCreate('PAGE_CONTAINER', Array, Object(XenForo_Template_Public))
#4 /srv/www/theadminzone.com/public_html/library/XenForo/CodeEvent.php(58): call_user_func_array(Array, Array)
#5 /srv/www/theadminzone.com/public_html/library/XenForo/Template/Abstract.php(82): XenForo_CodeEvent::fire('template_create', Array, 'PAGE_CONTAINER')
#6 /srv/www/theadminzone.com/public_html/library/XenForo/Dependencies/Public.php(239): XenForo_Template_Abstract->__construct('PAGE_CONTAINER', Array)
#7 /srv/www/theadminzone.com/public_html/library/XenForo/ViewRenderer/Abstract.php(263): XenForo_Dependencies_Public->createTemplateObject('PAGE_CONTAINER', Array)
#8 /srv/www/theadminzone.com/public_html/library/XenForo/ViewRenderer/HtmlPublic.php(119): XenForo_ViewRenderer_Abstract->createTemplateObject('PAGE_CONTAINER', Array)
#9 /srv/www/theadminzone.com/public_html/library/XenForo/FrontController.php(618): XenForo_ViewRenderer_HtmlPublic->renderContainer(Object(XenForo_Template_Public), Array)
#10 /srv/www/theadminzone.com/public_html/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#11 /srv/www/theadminzone.com/public_html/index.php(13): XenForo_FrontController->run()
#12 {main}
Request State
array(3) {
  ["url"] => string(67) "https://theadminzone.com/threads/list-of-free-forum-software.49185/"
  ["_GET"] => array(1) {
    ["/threads/list-of-free-forum-software_49185/"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

These errors come in bunches every few days to a week - been an ongoing issue. It's usually an unknown account, same two or three errors but different add-ons are mentioned in them - sometimes no add-ons are mentioned at all. It's been quite difficult to track down. If you want to take a look I'll give you access on TAZ. :)
 
A bit of background to this:

These errors are happening intermittently at TAZ. Occasionally it appears as though a specific add-on is causing it, but after checking with various add-on authors, @The Sandman hasn't been able to track down the specific add-on causing it.

@The Sandman, could you provide a screenshot of your installed add-ons, please?
 
@The Sandman, I ended up totally removing the TAC stuff that I had installed. There were one or two add-ons that had problems with them even though they were disabled. I don't remember which ones they were, but after removing all of them except StopHumanSpan I never got any more errors.

I don't know if that might be effecting any that you have, but it would be worth removing them.
 
Are these errors only related to viewing threads?

I'm not sure.
Random threads or specific ones?
Are they always around the same time of day or is this random?

Seems to be random threads, but sometimes in a specific forum (but not always the same one). Times are random as well, but all the errors in each batch happen quickly over a couple of minutes.
 
@The Sandman, I ended up totally removing the TAC stuff that I had installed. There were one or two add-ons that had problems with them even though they were disabled. I don't remember which ones they were, but after removing all of them except StopHumanSpan I never got any more errors.

I don't know if that might be effecting any that you have, but it would be worth removing them.

I'll try that!
 
This may be related to an opcode cache. If you're running APC -- particularly with PHP 5.4 -- I'd recommend trying something else (ideally PHP 5.5+ with the built-in opcode cache). We have seen several cases where literally impossible errors have occurred and they've generally been tracked back to opcode cache corruption.
 
This may be related to an opcode cache. If you're running APC -- particularly with PHP 5.4 -- I'd recommend trying something else (ideally PHP 5.5+ with the built-in opcode cache). We have seen several cases where literally impossible errors have occurred and they've generally been tracked back to opcode cache corruption.

The errors started on PHP 5.5 and have continued on PHP 5.6. I'll have to ask @MattW to chime in here to give our exact server setup, though I don't believe we're running APC.
 
Top Bottom