Merge branch '3.4' into 4.2

* 3.4:
  Fix Cache error while using anonymous class
  Update validators.cs.xlf
This commit is contained in:
Nicolas Grekas 2019-03-15 14:37:34 +01:00
commit e9814030c6
3 changed files with 29 additions and 0 deletions

View File

@ -66,6 +66,11 @@ class Psr6Cache implements CacheInterface
*/
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);
}
}

View File

@ -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>

View File

@ -23,4 +23,12 @@ class Psr6CacheTest extends AbstractCacheTest
$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'));
}
}