Skip to content
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

[Cache] Memcached $defaultClientOptions override passed serializer #33717

Closed
duronrulez opened this issue Sep 26, 2019 · 2 comments
Closed

[Cache] Memcached $defaultClientOptions override passed serializer #33717

duronrulez opened this issue Sep 26, 2019 · 2 comments

Comments

@duronrulez
Copy link

duronrulez commented Sep 26, 2019

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,
    ];
@javiereguiluz javiereguiluz added this to the 3.4 milestone Sep 26, 2019
@javiereguiluz javiereguiluz changed the title [symfony/cache] Memcached $defaultClientOptions override passed serializer [Cache] Memcached $defaultClientOptions override passed serializer Sep 26, 2019
@nicolas-grekas
Copy link
Member

Fixed in #33719

Meanwhile, you can use
MemcachedAdapter::createConnection($serversDsn, ['serializer' => 'igbinary']);

@duronrulez
Copy link
Author

Thanks, yes thats what we've applied temporary.

nicolas-grekas added a commit that referenced this issue Sep 26, 2019
…ekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[Cache] dont override native Memcached options

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

Commits
-------

894a78e [Cache] dont override native Memcached options
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

4 participants