Cannot reproduce Undefined index: user_selectable

Affected version
2.0.2

Alien

Well-known member
#1
Any ideas what could cause this?

Server error log
  • TypeError: Argument 1 passed to XF\Pub\Controller\AbstractController::getRequestIpConstraintCached() must be of the type array, boolean given, called in /home/sitename/public_html/src/XF/Pub/Controller/AbstractController.php on line 132
  • src/XF/Pub/Controller/AbstractController.php:350
  • Generated by: Unknown account
  • Feb 17, 2018 at 4:14 PM
Stack trace

#0 src/XF/Pub/Controller/AbstractController.php(132): XF\Pub\Controller\AbstractController->getRequestIpConstraintCached(false, 'isIpBanned')
#1 src/XF/Pub/Controller/AbstractController.php(15): XF\Pub\Controller\AbstractController->assertIpNotBanned()
#2 src/XF/Mvc/Controller.php(117): XF\Pub\Controller\AbstractController->preDispatchType('Index', Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Controller->preDispatch('Index', Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Index', 'Index', 'html', Object(XF\Mvc\ParameterBag), '', Object(XF\Pub\Controller\Index), NULL)
#5 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#7 src/XF.php(328): XF\App->run()
#8 index.php(13): XF::runApp('XF\\Pub\\App')
#9 {main}

Request state

array(4) {
["url"] => string(1) "/"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 

Alien

Well-known member
#2
Had another error in my logs...

Server error log
  • ErrorException: [E_NOTICE] Undefined index: user_selectable
  • src/XF/Style.php:275
  • Generated by: Unknown account
  • Feb 17, 2018 at 12:31 AM
Stack trace

#0 src/XF/Style.php(275): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/home/sitename/publi...', 275, Array)
#1 src/XF/Pub/App.php(341): XF\Style->offsetGet('user_selectable')
#2 src/XF/Mvc/Dispatcher.php(280): XF\Pub\App->preRender(Object(XF\Mvc\Reply\View), 'html')
#3 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#4 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#5 src/XF.php(328): XF\App->run()
#6 index.php(13): XF::runApp('XF\\Pub\\App')
#7 {main}

Request state

array(4) {
["url"] => string(35) "/threads/this-vs-that.31131/page-54"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 

Alien

Well-known member
#5
Relating to the same thread listed in the Request State:

Server error log
  • ErrorException: Template error: array_filter() expects parameter 1 to be array, boolean given
  • src/XF/Entity/User.php:565
  • Generated by: Unknown account
  • Feb 17, 2018 at 12:31 AM
Stack trace

#0 [internal function]: XF\Template\Templater->handleTemplateError(2, 'array_filter() ...', '/home/sitename/publi...', 565, Array)
#1 src/XF/Entity/User.php(565): array_filter(false, Object(Closure))
#2 [internal function]: XF\Entity\User->canChangeStyle()
#3 src/XF/Template/Templater.php(936): call_user_func_array(Array, Array)
#4 internal_data/code_cache/templates/l1/s0/public/PAGE_CONTAINER.php(1070): XF\Template\Templater->method(Object(Siropu\Shoutbox\XF\Entity\User), 'canChangeStyle', Array)
#5 src/XF/Template/Templater.php(1246): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array)
#6 src/XF/Pub/App.php(449): XF\Template\Templater->renderTemplate('PAGE_CONTAINER', Array)
#7 src/XF/App.php(1724): XF\Pub\App->renderPageHtml('\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#8 src/XF/Mvc/Dispatcher.php(310): XF\App->renderPage('\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#9 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#10 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#11 src/XF.php(328): XF\App->run()
#12 index.php(13): XF::runApp('XF\\Pub\\App')
#13 {main}

Request state

array(4) {
["url"] => string(35) "/threads/this-vs-that.31131/page-54"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 

Alien

Well-known member
#6
One more (after these, the errors ceased since last night)?

Server error log
  • ErrorException: Template error: count(): Parameter must be an array or an object that implements Countable
  • src/XF/Entity/User.php:566
  • Generated by: Unknown account
  • Feb 17, 2018 at 12:31 AM
Stack trace

#0 [internal function]: XF\Template\Templater->handleTemplateError(2, 'count(): Parame...', '/home/sitename/publi...', 566, Array)
#1 src/XF/Entity/User.php(566): count(NULL)
#2 [internal function]: XF\Entity\User->canChangeStyle()
#3 src/XF/Template/Templater.php(936): call_user_func_array(Array, Array)
#4 internal_data/code_cache/templates/l1/s0/public/PAGE_CONTAINER.php(1070): XF\Template\Templater->method(Object(Siropu\Shoutbox\XF\Entity\User), 'canChangeStyle', Array)
#5 src/XF/Template/Templater.php(1246): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array)
#6 src/XF/Pub/App.php(449): XF\Template\Templater->renderTemplate('PAGE_CONTAINER', Array)
#7 src/XF/App.php(1724): XF\Pub\App->renderPageHtml('\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n...', Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#8 src/XF/Mvc/Dispatcher.php(310): XF\App->renderPage('\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n...', Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#9 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#10 src/XF/App.php(1889): XF\Mvc\Dispatcher->run()
#11 src/XF.php(328): XF\App->run()
#12 index.php(13): XF::runApp('XF\\Pub\\App')
#13 {main}

Request state

array(4) {
["url"] => string(35) "/threads/this-vs-that.31131/page-54"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 

ozzy47

Well-known member
#9
Well it is not cut and dry, but I would say it is quite possibly the cause. I am sure someone else more knowledgeable will know for certain.
 

Chris D

XenForo developer
Staff member
#10
These all seem to be happening on the same page: threads/this-vs-that.31131/page-54

If the errors can be generated every time you visit that page of that thread then please switch off all add ons (there’s a switch to disable all) and try again.

If the errors are still logged in that state, provide us with updated error logs/trace details.

If not, try enabling add ons one by one until the culprit is identified.
 

Alien

Well-known member
#11
These all seem to be happening on the same page: threads/this-vs-that.31131/page-54

If the errors can be generated every time you visit that page of that thread then please switch off all add ons (there’s a switch to disable all) and try again.

If the errors are still logged in that state, provide us with updated error logs/trace details.

If not, try enabling add ons one by one until the culprit is identified.
Visited the thread (which hasn't been posted in for 4 years). Tried several times and zero error messages are created by the visits. Only variables that stick out at me in that page of that thread are: (1) out of just 2 posts in that page, the first that appears is banned, and (2) the same person has a username wrapped in <>'s.

I can try to visit it as a guest via another browser to see if anything triggers it that way..
 

Siropu

Well-known member
#13
The last two errors are clearly related to Siropu chat.
I don't think so. If you look at the file and line of the code is XF/Entiy/User -> canChangeStyle method which has nothing to do with my add-on. You see Siropu\Shoutbox\XF\Entity\User in the stack trace because it extends the user entity to add 3 simple methods for permission check.
 

Alien

Well-known member
#17
@Jake B. -- Could this error_log entry line be connected in some way, with either UI.X or Reactions (the only 2 current ThemeHouse add-ons I have installed):

(snip)
#5 src/XF/Template/Templater.php(1246): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array)
(/snip)
 

Chris D

XenForo developer
Staff member
#18
@Alien are these issues still happening? Do you have any sort of caching set up in src/config.php?

I'm struggling to see how this could be triggered at the moment.
 

Alien

Well-known member
#19
@Chris D I haven't gotten the exact errors again, but I do get occasional templater errors in setGroupStyles, setMediaSites

Its possible one or two of these errors could be caused by an add-on that hasn't made itself fully compatible with PHP 7.2 in some form. I know there were some similar errors in another developers add-ons at one point that got corrected a while back. Think that was an issue with countable if I'm not mistaken. Was it one of yours that got a 7.2 fix, @Xon ?

We only have file caching in config right now.

Code:
// Cache
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Filesystem';
$config['cache']['config'] = [
    'directory' => '/home/sitename/public_html/internal_data/cache'
];
 

Chris D

XenForo developer
Staff member
#20
Most of these errors (and the other one you just mentioned me in) are indicative mostly of the expected cache data not being available for some reason. Particularly the setGroupStyles and setMediaSites ones as that data comes straight from the cache.

I'm going to run my local install with file system caching for a bit to see if I can reproduce a similar issue, but it potentially is just indicative of the files not being read for some reason, or the reads taking longer than they're supposed to.

If there are any patterns to when the errors occur, such as at particularly busy times or similar then that could be quite telling.
 
Top