Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 52384fb

Browse filesBrowse files
committed
minor #17550 [Validator] PSR-6 cache: Avoid name collision (dunglas)
This PR was merged into the 3.1-dev branch. Discussion ---------- [Validator] PSR-6 cache: Avoid name collision | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a See tests. Commits ------- 12852c2 [Validator] PSR-6 cache: Avoid name collision
2 parents f1cdc6f + 12852c2 commit 52384fb
Copy full SHA for 52384fb

File tree

Expand file treeCollapse file tree

2 files changed

+11
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-2
lines changed

‎src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ public function write(ClassMetadata $metadata)
6767
}
6868

6969
/**
70-
* Replaces backslashes by underscores in a class name.
70+
* Replaces backslashes by dots in a class name.
7171
*
7272
* @param string $class
7373
*
7474
* @return string
7575
*/
7676
private function escapeClassName($class)
7777
{
78-
return strtr($class, '\\', '_');
78+
return strtr($class, '\\', '.');
7979
}
8080
}

‎src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Mapping/Cache/Psr6CacheTest.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Symfony\Component\Cache\Adapter\ArrayAdapter;
66
use Symfony\Component\Validator\Mapping\Cache\Psr6Cache;
7+
use Symfony\Component\Validator\Mapping\ClassMetadata;
78

89
/**
910
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -14,4 +15,12 @@ protected function setUp()
1415
{
1516
$this->cache = new Psr6Cache(new ArrayAdapter());
1617
}
18+
19+
public function testNameCollision()
20+
{
21+
$metadata = new ClassMetadata('Foo\\Bar');
22+
23+
$this->cache->write($metadata);
24+
$this->assertFalse($this->cache->has('Foo_Bar'));
25+
}
1726
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.