snc/SncRedisBundle

Warning with opcache preloading

Thomerdos opened this issue · 3 comments

I'm running the following configuration :

  • Apache server running on Alpine
  • PHP 8.2
  • Symfony 6.4
  • SncRedisBundle 4.7.0
  • opcache preloading set to opcache.preload=/var/www/app/config/preload.php
  • APP_ENV=PROD
  • composer install with the --no-dev flag

I'm getting the following message on server startup :

<b>Warning</b>:  Can't preload unlinked class Snc\RedisBundle\DependencyInjection\Configuration\RedisDsn@anonymous: Unknown parent Snc\RedisBundle\DependencyInjection\Configuration\RedisDsn in <b>/var/www/app/vendor/snc/redis-bundle/src/Factory/PhpredisClientFactory.php</b> on line <b>151</b><br />

The issue doesn't occurs in dev environnement.

I'm using Redis for the session with Redis Sentinel, it works in production even with the warning.

I don't know if this a symfony or bundle issue.

Hello!
I'm having the same issue with the following configuration:

  • Nginx server running on Alpine
  • PHP-FPM 8.2
  • Symfony 6.2
  • SncRedisbundle 4.7.0
  • Opcache preloading set to opcache.preload=/var/www/config/preload.php
  • APP_ENV=prod
  • composer install without flags

There error message is the following:

<b>Warning</b>:  Can't preload unlinked class Snc\RedisBundle\DependencyInjection\Configuration\RedisDsn@anonymous: Unknown parent Snc\RedisBundle\DependencyInjection\Configuration\RedisDsn in <b>/var/www/vendor/snc/redis-bundle/src/Factory/PhpredisClientFactory.php</b> on line <b>151</b><br />

It's also running inside of Docker. I'm using regular Redis in a different container.

Apparently, the fix would be to add the following line to PhpredisClientFactory.php, before the class declaration.
Similar like in Twig

class_exists(RedisDsn::class);

Have you tried that? If it's so simple, I can add it. But somebody should test it first.