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

Skip to content

Invalid Redis socket DSN, the "dbindex" parameter must be a number. #44215

Closed
@mathielen

Description

@mathielen

Symfony version(s) affected

4.4.34

Description

When the Cache component is configured with a Redis DSN pointing to a socket (eg. redis:///var/run/redis/redis-server.sock), an error is thrown: Invalid Redis DSN: "redis:///var/run/redis/redis-server.sock", the "dbindex" parameter must be a number.

This is probably due to #43359 with fix #44043 and an incorrect preg_match in L151.

How to reproduce

<?php
// config/packages/cache.php

use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
    $cache = $framework->cache();

    $cache->app('cache.adapter.redis')
        ->defaultRedisProvider('redis:///var/run/redis/redis-server.sock');

    $cache->pool('my_pool.cache')->adapters(['cache.app']);
};

Possible Solution

Skip the preg_match check if $params['host'] is not set?

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions