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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pesseyjulien opened this issue May 31, 2022 · 1 comment

Comments

@pesseyjulien
Copy link

pesseyjulien commented May 31, 2022

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

@pesseyjulien pesseyjulien changed the title [Cache] [Cache] Redis strlen(): Passing null to parameter #1 ($string) of type string is deprecated May 31, 2022
@xabbuh
Copy link
Member

xabbuh commented Jun 1, 2022

see #46543

chalasr added a commit that referenced this issue Jun 1, 2022
This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] do not pass null to strlen()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #46530
| License       | MIT
| Doc PR        |

Commits
-------

4a9d6a5 [Cache] do not pass null to strlen()
@xabbuh xabbuh closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants