Fixed Redis Cache Eror

Onurhan T.

Member
Affected version
Release Candidate 3
Hello,

After the update, the Redis Cache plugin gives an error and the home page cannot be reached.

Code:
Fatal Error: Declaration of SV\RedisCache\XF\Pub\Controller\Forum::applyDateLimitFilters(XF\Entity\Forum $forum, XF\Finder\Thread $threadFinder, array $filters) must be compatible with XF\Pub\Controller\ForumController::applyDateLimitFilters(XF\Entity\Forum $forum, XF\Finder\ThreadFinder $threadFinder, array $filters)
 
This is caused by a recent XF change and it is fixed in the next release.

You could disable that add-on or the caching configuration for now.
 
This is caused by a recent XF change and it is fixed in the next release.

You could disable that add-on or the caching configuration for now.

I noticed this. When I remove the plugin and configure config.php, I can run Redis actively.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
What settings did you use in config.php to get redis to work on xF 2.3.0 without Xon's Redis Cache plugin, as the following settings I'm using result in a 500 error (altho the below code works for xf 2.2.x)....

PHP:
# Redis
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['provider'] = 'Redis';
$config['cache']['config'] = [
    'host' => '127.0.0.1',
    'password' => '*****',
    'port' => 6379,
    'database' => 1
];

On checking server logs, I see the following error...

Code:
1644#0: *533 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Symfony\Component\Cache\Exception\InvalidArgumentException: Redis connection failed: WRONGPASS invalid username-password pair or user is disabled. in /var/www/vhosts/***/src/vendor/symfony/cache/Traits/RedisTrait.php:299
Stack trace:
#0 /var/www/vhosts/***/src/vendor/symfony/cache/Traits/RedisTrait.php(308): Symfony\Component\Cache\Adapter\RedisAdapter::Symfony\Component\Cache\Traits\{closure}(Object(Redis))
#1 /var/www/vhosts/***/src/XF/CacheFactory.php(297): Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('...', Array)
#2 /var/www/vhosts/***/src/XF/CacheFactory.php(101): XF\CacheFactory->createRedisCache(Array)
#3 /var/www/vhosts/***/src/XF/App.php(813): XF\CacheFactory->create('...', Array)
#4 /var/www/vhosts/***/" while reading response header from upstream

Which is weird, as correct redis password is in config.php, and it works when Xon's Redis Cache plugin is enabled and 'provider' line is changed to SV\RedisCache\Redis.
 
Last edited:
What settings did you use in config.php to get redis to work on xF 2.3.0 without Xon's Redis Cache plugin, as the following settings I'm using result in a 500 error (altho the below code works for xf 2.2.x)....

PHP:
# Redis
$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['provider'] = 'Redis';
$config['cache']['config'] = [
    'host' => '127.0.0.1',
    'password' => '*****',
    'port' => 6379,
    'database' => 1
];

On checking server logs, I see the following error...

Code:
1644#0: *533 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Symfony\Component\Cache\Exception\InvalidArgumentException: Redis connection failed: WRONGPASS invalid username-password pair or user is disabled. in /var/www/vhosts/***/src/vendor/symfony/cache/Traits/RedisTrait.php:299
Stack trace:
#0 /var/www/vhosts/***/src/vendor/symfony/cache/Traits/RedisTrait.php(308): Symfony\Component\Cache\Adapter\RedisAdapter::Symfony\Component\Cache\Traits\{closure}(Object(Redis))
#1 /var/www/vhosts/***/src/XF/CacheFactory.php(297): Symfony\Component\Cache\Adapter\RedisAdapter::createConnection('...', Array)
#2 /var/www/vhosts/***/src/XF/CacheFactory.php(101): XF\CacheFactory->createRedisCache(Array)
#3 /var/www/vhosts/***/src/XF/App.php(813): XF\CacheFactory->create('...', Array)
#4 /var/www/vhosts/***/" while reading response header from upstream

Which is weird, as correct redis password is in config.php, and it works when Xon's Redis Cache plugin is enabled and 'provider' line is changed to SV\RedisCache\Redis.

I am using these settings.

$config['cache']['enabled'] = true;
$config['cache']['sessions'] = true;
$config['cache']['provider'] = 'Redis';
$config['cache']['config']['host'] = '127.0.0.1';

If the page does not open after removing the plugin, it means that it is not working on your redis server.
 
Last edited:
It might help to work around the issue in the meantime, but I think we might have to make some changes here. Our cache library (Symfony) may need us to URL-encode special characters in the configuration (due to their awful DSN concept).
 
Back
Top Bottom