diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 259906e90f..e4439bce5e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -131,7 +131,7 @@ class FrameworkExtension extends Extension
'macvim' => 'mvim://open?url=file://%%f&line=%%l',
'emacs' => 'emacs://open?url=file://%%f&line=%%l',
'sublime' => 'subl://open?url=file://%%f&line=%%l',
- 'phpstorm' => 'phpstorm://open?url=file://%%f&line=%%l',
+ 'phpstorm' => 'phpstorm://open?file=%%f&line=%%l',
);
$ide = $config['ide'];
diff --git a/src/Symfony/Component/Config/Resource/DirectoryResource.php b/src/Symfony/Component/Config/Resource/DirectoryResource.php
index 434c048b67..07280b4b87 100644
--- a/src/Symfony/Component/Config/Resource/DirectoryResource.php
+++ b/src/Symfony/Component/Config/Resource/DirectoryResource.php
@@ -90,8 +90,15 @@ class DirectoryResource implements SelfCheckingResourceInterface, \Serializable
continue;
}
+ // for broken links
+ try {
+ $fileMTime = $file->getMTime();
+ } catch (\RuntimeException $e) {
+ continue;
+ }
+
// early return if a file's mtime exceeds the passed timestamp
- if ($timestamp < $file->getMTime()) {
+ if ($timestamp < $fileMTime) {
return false;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php
index 309a2750f9..4b11028be5 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php
@@ -257,6 +257,9 @@ class OutputFormatterTest extends TestCase
$this->assertEquals(
'some question', $formatter->format('some question')
);
+ $this->assertEquals(
+ 'some text with inline style', $formatter->format('some text with inline style>')
+ );
$formatter->setDecorated(true);
@@ -272,6 +275,9 @@ class OutputFormatterTest extends TestCase
$this->assertEquals(
"\033[30;46msome question\033[39;49m", $formatter->format('some question')
);
+ $this->assertEquals(
+ "\033[31msome text with inline style\033[39m", $formatter->format('some text with inline style>')
+ );
}
public function testContentWithLineBreaks()
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
index 12ba696e13..01c99eb538 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
@@ -156,6 +156,22 @@ class ChoiceType extends AbstractType
// transformation is merged back into the original collection
$builder->addEventSubscriber(new MergeCollectionListener(true, true));
}
+
+ // To avoid issues when the submitted choices are arrays (i.e. array to string conversions),
+ // we have to ensure that all elements of the submitted choice data are strings or null.
+ $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
+ $data = $event->getData();
+
+ if (!is_array($data)) {
+ return;
+ }
+
+ foreach ($data as $v) {
+ if (null !== $v && !is_string($v)) {
+ throw new TransformationFailedException('All choices submitted must be NULL or strings.');
+ }
+ }
+ }, 256);
}
/**
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
index 1899005573..864e670a6e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
@@ -13,8 +13,10 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
+use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
+use Symfony\Component\Form\Test\TypeTestCase;
-class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
+class ChoiceTypeTest extends TypeTestCase
{
private $choices = array(
'Bernhard' => 'a',
@@ -1743,4 +1745,30 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
// In this case the 'choice_label' closure returns null and not the closure from the first choice type.
$this->assertNull($form->get('subChoice')->getConfig()->getOption('choice_label'));
}
+
+ /**
+ * @dataProvider invalidNestedValueTestMatrix
+ */
+ public function testSubmitInvalidNestedValue($multiple, $expanded, $submissionData)
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
+ 'choices' => $this->choices,
+ 'multiple' => $multiple,
+ 'expanded' => $expanded,
+ ));
+
+ $form->submit($submissionData);
+ $this->assertFalse($form->isSynchronized());
+ $this->assertEquals('All choices submitted must be NULL or strings.', $form->getTransformationFailure()->getMessage());
+ }
+
+ public function invalidNestedValueTestMatrix()
+ {
+ return array(
+ 'non-multiple, non-expanded' => array(false, false, array(array())),
+ 'non-multiple, expanded' => array(false, true, array(array())),
+ 'multiple, non-expanded' => array(true, false, array(array())),
+ 'multiple, expanded' => array(true, true, array(array())),
+ );
+ }
}
diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php
index 1d1c013f67..7dd1c2158e 100644
--- a/src/Symfony/Component/Yaml/Tests/InlineTest.php
+++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php
@@ -718,4 +718,15 @@ class InlineTest extends TestCase
'null before comma' => array('{foo:, bar: baz}', array('foo' => null, 'bar' => 'baz')),
);
}
+
+ public function testBooleanMappingKeysAreConvertedToStrings()
+ {
+ $this->assertSame(array('false' => 'foo'), Inline::parse('{false: foo}'));
+ $this->assertSame(array('true' => 'foo'), Inline::parse('{true: foo}'));
+ }
+
+ public function testTheEmptyStringIsAValidMappingKey()
+ {
+ $this->assertSame(array('' => 'foo'), Inline::parse('{ "": foo }'));
+ }
}