Skip to content

Commit

Permalink
Merge branch '3.4' into 4.2
Browse files Browse the repository at this point in the history
* 3.4:
  Fix Cache error while using anonymous class
  Update validators.cs.xlf
  • Loading branch information
nicolas-grekas committed Mar 15, 2019
2 parents 13c32a9 + 613bc42 commit e981403
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Symfony/Component/Validator/Mapping/Cache/Psr6Cache.php
Expand Up @@ -66,6 +66,11 @@ public function write(ClassMetadata $metadata)
*/
private function escapeClassName(string $class): string
{
if (false !== strpos($class, '@')) {
// anonymous class: replace all PSR6-reserved characters
return str_replace(["\0", '\\', '/', '@', ':', '{', '}', '(', ')'], '.', $class);
}

return str_replace('\\', '.', $class);
}
}
Expand Up @@ -318,6 +318,22 @@
<source>Error</source>
<target>Chyba</target>
</trans-unit>
<trans-unit id="83">
<source>This is not a valid UUID.</source>
<target>Tato hodnota není platné UUID.</target>
</trans-unit>
<trans-unit id="84">
<source>This value should be a multiple of {{ compared_value }}.</source>
<target>Tato hodnota musí být násobek hodnoty {{ compared_value }}.</target>
</trans-unit>
<trans-unit id="85">
<source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source>
<target>Bankovní identifikační kód (BIC) neodpovídá mezinárodnímu číslu účtu (IBAN) {{ iban }}.</target>
</trans-unit>
<trans-unit id="86">
<source>This value should be valid JSON.</source>
<target>Tato hodnota musí být validní JSON.</target>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -23,4 +23,12 @@ public function testNameCollision()
$this->cache->write($metadata);
$this->assertFalse($this->cache->has('Foo_Bar'));
}

public function testNameWithInvalidChars()
{
$metadata = new ClassMetadata('class@anonymous/path/file');

$this->cache->write($metadata);
$this->assertTrue($this->cache->has('class@anonymous/path/file'));
}
}

0 comments on commit e981403

Please sign in to comment.