8000 Merge branch '3.4' into 4.2 · symfony/symfony@e981403 · GitHub
[go: up one dir, main page]

Skip to content

Commit e981403

Browse files
Merge branch '3.4' into 4.2
* 3.4: Fix Cache error while using anonymous class Update validators.cs.xlf
2 parents 13c32a9 + 613bc42 commit e981403

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public function write(ClassMetadata $metadata)
6666
*/
6767
private function escapeClassName(string $class): string
6868
{
69+
if (false !== strpos($class, '@')) {
70+
// anonymous class: replace all PSR6-reserved characters
71+
return str_replace(["\0", '\\', '/', '@', ':', '{', '}', '(', ')'], '.', $class);
72+
}
73+
6974
return str_replace('\\', '.', $class);
7075
}
7176
}

src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,22 @@
318318
<source>Error</source>
319319
<target>Chyba</target>
320320
</trans-unit>
321+
<trans-unit id="83">
322+
<source>This is not a valid UUID.</source>
323+
<target>Tato hodnota není platné UUID.</target>
324+
</trans-unit>
325+
<trans-unit id="84">
326+
<source>This value should be a multiple of {{ compared_value }}.</source>
327+
<target>Tato hodnota musí být násobek hodnoty {{ compared_value }}.</target>
328+
</trans-unit>
329+
<trans-unit id="85">
330+
<source>This Business Identifier Code (BIC) C7FB is not associated with IBAN {{ iban }}.</source>
331+
<target>Bankovní identifikační kód (BIC) neodpovídá mezinárodnímu číslu účtu (IBAN) {{ iban }}.</target>
332+
</trans-unit>
333+
<trans-unit id="86">
334+
<source>This value should be valid JSON.</source>
335+
<target>Tato hodnota musí být validní JSON.</target>
336+
</trans-unit>
321337
</body>
322338
</file>
323339
</xliff>

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ public function testNameCollision()
2323
$this->cache->write($metadata);
2424
$this->assertFalse($this->cache->has('Foo_Bar'));
2525
}
26+
27+
public function testNameWithInvalidChars()
28+
{
29+
$metadata = new ClassMetadata('class@anonymous/path/file');
30+
31+
$this->cache->write($metadata);
32+
$this->assertTrue($this->cache->has('class@anonymous/path/file'));
33+
}
2634
}

0 commit comments

Comments
 (0)
0