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

Skip to content

[Cache] Memcached $defaultClientOptions override passed serializer #33717

Closed
@duronrulez

Description

@duronrulez

Symfony version(s) affected: 3.4.* (but pretty sure all version have it)

Description
When you want to change the serializer option for memcached, it gets overriden by the default options.

How to reproduce
MemcachedAdapter::createConnection($serversDsn, [\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY]);
// this creates the connections with the default serializer PHP from the MemcachedTrait $defaultClientOptions

Possible Solution
instead of using this:

    private static $defaultClientOptions = [
        'persistent_id' => null,
        'username' => null,
        'password' => null,
        'serializer' => 'php',
    ];

use this:

    private static $defaultClientOptions = [
        'persistent_id' => null,
        'username' => null,
        'password' => null,
        \Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_PHP,
    ];

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions