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

Skip to content

TagAwareAdapter over nonbinary memcached connections corrupts memcache. #27405

Closed
@palex-fpt

Description

@palex-fpt

Symfony version(s) affected: 4.0.0

Description
TagAwareAdapter over nonbinary memcached connections corrupts memcache.

How to reproduce

	public function testTagAwareAdapterOverMemcached()
	{
		$nonbinaryMemcached = new \Memcached();
		$nonbinaryMemcached->addServer('memcached', 11211);
		$nonbinaryMemcached->setOption(\Memcached::OPT_BINARY_PROTOCOL, false);
		$simpleCache = new MemcachedAdapter($nonbinaryMemcached);
		$tagAwareCache = new TagAwareAdapter($simpleCache);

		$simpleCache->save($simpleCache->getItem("simple")->set(1));

		// TagAwareAdapter corrupts nonbinary memcached
		$tagAwareCache->save($tagAwareCache->getItem("tagged")->set(1));

		$this->assertEquals(1, $simpleCache->getItem("simple")->get());
	}

Possible Solution
TagAwareAdapter uses '\0' in key names, that are incompatible with memcached in normal mode. Possible solution is to change key prefix.

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