Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Cache] Redis strlen(): Passing null to parameter #1 ($string) of type string is deprecated #46530

Closed
@pesseyjulien

Description

@pesseyjulien

Symfony version(s) affected

5.4.9

Description

Hi,

When running the following command :

bin/console doctrine:cache:clear-result

I'm getting the following error :

PHP Deprecated:  strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/vendor/symfony/cache/Traits/RedisTrait.php on line 390

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/vendor/symfony/cache/Traits/RedisTrait.php on line 390

Here is my cache config :

snc_redis:
    clients:
        default:
            type: predis
            alias: redis_client
            logging: false
            dsn: '%env(REDIS_URL)%'

framework:
    cache:
        prefix_seed: xxx
        app: cache.adapter.redis
        default_redis_provider: snc_redis.redis_client
        pools:
            doctrine.metadata_cache_driver:
                adapter: cache.app
            doctrine.result_cache_pool:
                adapter: cache.app
            doctrine.system_cache_pool:
                adapter: cache.app
            doctrine.second_level_cache_pool:
                adapter: cache.app
            cache.api_rate_limit:
                adapter: cache.adapter.redis
                provider: snc_redis.redis_client

The doClear in RedisTrait should return '' and not null :

$prefix = $this->redis->getOptions()->prefix ? $this->redis->getOptions()->prefix->getPrefix() : '';

Thanks in advance,
Julien

How to reproduce

  • Setup doctrine cache with redis
  • run : bin/console doctrine:cache:clear-result

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions