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

Fix PSR16 compatibility by sanitizing Colon symbol #447

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion src/Jackalope/Transport/DoctrineDBAL/CachedClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(FactoryInterface $factory, Connection $conn, array $

$this->caches = $caches;
$this->keySanitizer = static function ($cacheKey) {
return str_replace(' ', '_', $cacheKey);
return str_replace([' ', ':'], '_', $cacheKey);
dbu marked this conversation as resolved.
Show resolved Hide resolved
};
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Jackalope/Transport/DoctrineDBAL/CachedClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testArrayObjectIsConvertedToArray()
public function testCacheHit()
{
$cache = new \stdClass();
$this->cacheMock->method('fetch')->with('nodes:_/test,_tests')->willReturn($cache);
$this->cacheMock->method('fetch')->with('nodes__/test,_tests')->willReturn($cache);
alexander-schranz marked this conversation as resolved.
Show resolved Hide resolved

$this->assertSame($cache, $this->transport->getNode('/test'));
}
Expand All @@ -45,7 +45,7 @@ public function testDefaultKeySanitizer()
$this->cacheMock
->method('fetch')
->with(self::callback(function ($arg) use (&$first) {
self::assertEquals($first ? 'nodetypes:_a:0:{}' : 'node_types', $arg);
self::assertEquals($first ? 'nodetypes__a_0_{}' : 'node_types', $arg);
dbu marked this conversation as resolved.
Show resolved Hide resolved
alexander-schranz marked this conversation as resolved.
Show resolved Hide resolved
$first = false;

return true;
Expand Down
Loading