Fixed Argument 1 passed to XF\Template\Templater::setGroupStyles() must be of the type array

Nirjonadda

Well-known member
Affected version
2.0.1
Server error log.

Code:
TypeError: Argument 1 passed to XF\Template\Templater::setGroupStyles() must be of the type array, boolean given, called in /home/nadda/public_html/src/XF/App.php on line 1451 src/XF/Template/Templater.php:406

Generated by: Arman Piash Dec 20, 2017 at 1:48 PM

Stack trace

#0 src/XF/App.php(1451): XF\Template\Templater->setGroupStyles(false)
#1 src/XF/App.php(1079): XF\App->setupTemplaterObject(Object(XF\Container), 'ThemeHouse\\Reac...')
#2 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#3 src/XF/App.php(2641): XF\Container->offsetGet('templater')
#4 src/XF/Pub/App.php(348): XF\App->templater()
#5 src/XF/Mvc/Dispatcher.php(280): XF\Pub\App->preRender(Object(XF\Mvc\Reply\View), 'raw')
#6 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'raw')
#7 src/XF/App.php(1880): XF\Mvc\Dispatcher->run()
#8 src/XF.php(328): XF\App->run()
#9 index.php(13): XF::runApp('XF\\Pub\\App')
#10 {main}

Request state

array(4) {
  ["url"] => string(23) "/attachments/z-jpg.630/"
  ["referrer"] => string(42) "/threads/105668/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Are you using a cache object?

You seem to be having various errors that indicate unexpected data is being returned. You also seem to be having a number of errors that are specific to you, along with a history of errors caused by server issues dating back to XF1. It is very possible that these issues are intertwined and that you're actually having failed calls to your cache layer.
 
but I can confirm that we are using Redis cache in config.php
Well that's a cache and it is the cause. It's triggering when cache actions are failing.

Are you using the out of the box Redis cache support or an add-on? If it's the latter, this might be something to check with the add-on author.
 
Are you using the out of the box Redis cache support or an add-on?

No add-on, only using in /src/config.php

Code:
$config['cache']['enabled'] = true;
$config['cache']['provider'] = 'Redis';
$config['cache']['config'] = [
    'host' => '127.0.0.1',
];
 
It sounds like there is corrupt data in your cache - have you tried doing a drastic FLUSHALL on the Redis cache to see if it resolves the issue when there is fresh data?
 
It sounds like there is corrupt data in your cache - have you tried doing a drastic FLUSHALL on the Redis cache to see if it resolves the issue when there is fresh data?

Yes, Now i am removed all the keys of all the existing database. I will wait for new error log from cache.

Code:
[root@ra ~]# redis-cli FLUSHALL
OK
[root@ra ~]#
 
Okay, let us know if the error(s) reappear - I think this may well explain all of your open bug reports.
 
@Nirjonadda are you using the latest versions of phpredis (the php extension required for the built-in redis connector) and redis?

You should be getting exceptions on failed cache updates for redis to store dodgy data, otherwise all I can think of is memory corruption issue somewhere.

Have you tried doing a memory test? It might be your site has dodgy hardware somewhere.
 
@Nirjonadda are you using the latest versions of phpredis (the php extension required for the built-in redis connector) and redis?

You should be getting exceptions on failed cache updates for redis to store dodgy data, otherwise all I can think of is memory corruption issue somewhere.

Have you tried doing a memory test? It might be your site has dodgy hardware somewhere.

phpredis version latest 3.1.5 and redis server version 3.2.2. How to check memory test?
 
I've just been testing REDIS with the inbuilt XF2 support and I am seeing the same types of errors. Did you make any progress?
 
Errors are :

Error: Unsupported operand types src/XF/App.php:1020 Generated by: Unknown account Mar 22, 2018 at 12:23 AM Stack trace
#0 src/XF/Container.php(228): XF\App->XF\{closure}('3', Array,
Object(XF\Container))
#1 src/XF/Pub/App.php(337): XF\Container->create('style', 0)
#2 src/XF/Mvc/Dispatcher.php(280):
XF\Pub\App->preRender(Object(XF\Mvc\Reply\Redirect), 'html')
#3 src/XF/Mvc/Dispatcher.php(44):
XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\Redirect), 'html')
#4 src/XF/App.php(1891): 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(26) "/community/threads/367051/"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

And

TypeError: Argument 1 passed to XF\Template\Templater::setUserBanners()
must be of the type array, boolean given, called in /home/domain/domains/domain/public_html/community/src/XF/App.php
on line 1460 src/XF/Template/Templater.php:415 Generated by: Unknown account Mar 22, 2018 at 1:00 AM Stack trace
#0 src/XF/App.php(1460): XF\Template\Templater->setUserBanners(false,
Array)
#1 src/XF/App.php(1084):
XF\App->setupTemplaterObject(Object(XF\Container),
'XF\\Template\\Tem...')
#2 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#3 src/XF/App.php(2652): XF\Container->offsetGet('templater')
#4 src/XF/Pub/App.php(348): XF\App->templater()
#5 src/XF/Mvc/Dispatcher.php(280):
XF\Pub\App->preRender(Object(XF\Mvc\Reply\Redirect), 'html')
#6 src/XF/Mvc/Dispatcher.php(44):
XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\Redirect), 'html')
#7 src/XF/App.php(1891): XF\Mvc\Dispatcher->run()
#8 src/XF.php(328): XF\App->run()
#9 index.php(13): XF::runApp('XF\\Pub\\App')
#10 {main}
Request state
array(4) {
["url"] => string(26) "/community/gallery/342146/"
["referrer"] => bool(false)
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

Our forum tech thinks XF2 might not fully support Redis, is that the case and if so, how do we resolve it?

The other threads we found show as a resolved bug reports, which is why I created this one.
Hopefully that means you have a solution for us.
https://xenforo.com/community/threads/unsupported-operand-types-src-xf-app-php-1015.139445/
https://xenforo.com/community/threa...ust-be-of-the-type-array.139491/#post-1205259

Thank you.
 
Last edited by a moderator:
Bugs aren’t necessarily handled as soon as they come in so if it’s something that needs a reply then posting elsewhere on the forum or submitting a ticket is preferable.

That said, Redis is fully supported but indeed at the time this request happened, some data either wasn’t available in Redis or came out in an unexpected format. This can happen for example if Redis was restarted unexpectedly. If the errors were a one off, then they can be safely ignored. If they are persistent, I’d recommend looking at whether Redis itself is functioning properly or if there are reasons that might explain that data not being available at that time, such as it becoming unavailable or unable to connect for some reason.
 
If the errors were a one off, then they can be safely ignored. If they are persistent, I’d recommend looking at whether Redis itself is functioning properly or if there are reasons that might explain that data not being available at that time, such as it becoming unavailable or unable to connect for some reason.
@Nirjonadda told me he was seeing the same errors regularly even when he switched to Xon's Redis add-on.
 
Back
Top Bottom