Skip to content

Commit 06acaea

Browse files
Merge branch '2.3' into 2.6
* 2.3: Fixed the regexp for the validator of Maestro-based credit/debit cards [Console] Fix STDERR output text on IBM iSeries OS400 [HttpFoundation] Use convention to allow throwing from __toString() [Form] Fixed: remove quoted strings from Intl date formats (e.g. es_ES full pattern) [bugfix][MonologBridge] WebProcessor: passing to BaseWebProcessor [2.3] Static Code Analysis for Components [Translation][update cmd] taken account into bundle overrides path. Conflicts: src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php src/Symfony/Component/Filesystem/Tests/FilesystemTest.php src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php
2 parents 3e22e76 + a4d6497 commit 06acaea

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

Extension/Core/Type/DateType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ public function finishView(FormView $view, FormInterface $form, array $options)
146146

147147
// remove special characters unless the format was explicitly specified
148148
if (!is_string($options['format'])) {
149+
// remove quoted strings first
150+
$pattern = preg_replace('/\'[^\']+\'/', '', $pattern);
151+
152+
// remove remaining special chars
149153
$pattern = preg_replace('/[^yMd]+/', '', $pattern);
150154
}
151155

Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testSameChoiceFieldCreatedMultipleTimes()
3030
$choices = range(1, 300);
3131

3232
for ($i = 0; $i < 100; ++$i) {
33-
$this->factory->create('choice', rand(1, 400), array(
33+
$this->factory->create('choice', mt_rand(1, 400), array(
3434
'choices' => $choices,
3535
));
3636
}

Tests/Extension/Core/Type/DateTypeTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,20 @@ public function testDontPassDatePatternIfText()
627627
$this->assertFalse(isset($view->vars['date_pattern']));
628628
}
629629

630+
public function testDatePatternFormatWithQuotedStrings()
631+
{
632+
\Locale::setDefault('es_ES');
633+
634+
$form = $this->factory->create('date', null, array(
635+
// EEEE, d 'de' MMMM 'de' y
636+
'format' => \IntlDateFormatter::FULL,
637+
));
638+
639+
$view = $form->createView();
640+
641+
$this->assertEquals('{{ day }}{{ month }}{{ year }}', $view->vars['date_pattern']);
642+
}
643+
630644
public function testPassWidgetToView()
631645
{
632646
$form = $this->factory->create('date', null, array(

0 commit comments

Comments
 (0)