8000 Merge branch '2.1' · symfony/symfony@aba96c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit aba96c7

Browse files
committed
Merge branch '2.1'
* 2.1: [Console] Fix style escaping parsing [Console] Make style formatter matching less greedy to avoid having to escape when not needed [Bundle] [FrameworkBundle] fixed indentation in esi.xml services file. [Component] [Security] fixed PSR-2 coding violation in ClassUtilsTest class. [Form] Fixed EntityChoiceList when loading objects with negative integer IDs [TwigBundle] There is no CSS visibility of display, should be visible instead [Form] corrected source node for a Danish translation [DependencyInjection] fixed a bug where the strict flag on references were lost (closes #6607) [HttpFoundation] Check if required shell functions for `FileBinaryMimeTypeGuesser` are not disabled [CssSelector] added css selector with empty string [HttpFoundation] Docblock for Request::isXmlHttpRequest() now points to Wikipedia [DependencyInjection] refactored code to avoid logic duplication [Form] Deleted references in FormBuilder::getFormConfig() to improve performance [HttpFoundation] Update docblock for non-working method Conflicts: src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.html.twig src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.html.twig
2 parents 8c320b0 + 8321127 commit aba96c7

File tree

19 files changed

+184
-50
lines changed

19 files changed

+184
-50
lines changed

src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function getIndicesForValues(array $values)
329329
protected function createIndex($entity)
330330
{
331331
if ($this->idAsIndex) {
332-
return current($this->getIdentifierValues($entity));
332+
return $this->fixIndex(current($this->getIdentifierValues($entity)));
333333
}
334334

335335
return parent::createIndex($entity);
@@ -355,6 +355,23 @@ protected function createValue($entity)
355355
return parent::createValue($entity);
356356
}
357357

358+
/**
359+
* {@inheritdoc}
360+
*/
361+
protected function fixIndex($index)
362+
{
363+
$index = parent::fixIndex($index);
364+
365+
// If the ID is a single-field integer identifier, it is used as
366+
// index. Replace any leading minus by underscore to make it a valid
367+
// form name.
368+
if ($this->idAsIndex && $index < 0) {
369+
$index = strtr($index, '-', '_');
370+
}
371+
372+
return $index;
373+
}
374+
358375
/**
359376
* Loads the list with entities.
360377
*/

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/EntityChoiceListTest.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,47 @@ public function testSingleNonIntIdFallsBackToGeneration()
312312

313313
$this->assertSame(array(0 => $entity1, 1 => $entity2), $choiceList->getChoices());
314314
}
315+
316+
public function testMinusReplacedByUnderscoreInNegativeIntIds()
317+
{
318+
$entity1 = new SingleIdentEntity(-1, 'Foo');
319+
$entity2 = new SingleIdentEntity(1, 'Bar');
320+
321+
// Persist for managed state
322+
$this->em->persist($entity1);
323+
$this->em->persist($entity2);
324+
$this->em->flush();
325+
326+
$choiceList = new EntityChoiceList(
327+
$this->em,
328+
self::SINGLE_IDENT_CLASS,
329+
'name'
330+
);
331+
332+
$this->assertSame(array('_1' => $entity1, 1 => $entity2), $choiceList->getChoices());
333+
$this->assertSame(array('_1', 1), $choiceList->getIndicesForChoices(array($entity1, $entity2)));
334+
$this->assertSame(array('_1', 1), $choiceList->getIndicesForValues(array('-1', '1')));
335+
}
336+
337+
public function testMinusReplacedByUnderscoreIfNotLoaded()
338+
{
339+
$entity1 = new SingleIdentEntity(-1, 'Foo');
340+
$entity2 = new SingleIdentEntity(1, 'Bar');
341+
342+
// Persist for managed state
343+
$this->em->persist($entity1);
344+
$this->em->persist($entity2);
345+
$this->em->flush();
346+
347+
$choiceList = new EntityChoiceList(
348+
$this->em,
349+
self::SINGLE_IDENT_CLASS,
350+
'name'
351+
);
352+
353+
// no getChoices()!
354+
355+
$this->assertSame(array('_1', 1), $choiceList->getIndicesForChoices(array($entity1, $entity2)));
356+
$this->assertSame(array('_1', 1), $choiceList->getIndicesForValues(array('-1', '1')));
357+
}
315358
}

src/Symfony/Bundle/FrameworkBundle/Resources/config/esi.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<service id="esi" class="%esi.class%" />
1414

1515
<service id="esi_listener" class="%esi_listener.class%">
16-
<tag name="kernel.event_subscriber" />
17-
<argument type="service" id="esi" on-invalid="ignore" />
16+
<tag name="kernel.event_subscriber" />
17+
<argument type="service" id="esi" on-invalid="ignore" />
1818
</service>
1919
</services>
2020
</container>

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/trace.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
in {{ trace.file|format_file(trace.line) }}&nbsp;
1313
{% spaceless %}
1414
<a href="#" onclick="toggle('trace-{{ prefix ~ '-' ~ i }}'); switchIcons('icon-{{ prefix ~ '-' ~ i }}-open', 'icon-{{ prefix ~ '-' ~ i }}-close'); return false;">
15-
<img class="toggle" id="icon-{{ prefix ~ '-' ~ i }}-close" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="visibility: {{ 0 == i ? 'display' : 'hidden' }}" />
16-
<img class="toggle" id="icon-{{ prefix ~ '-' ~ i }}-open" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="visibility: {{ 0 == i ? 'hidden' : 'display' }}; margin-left: -18px" />
15+
<img class="toggle" id="icon-{{ prefix ~ '-' ~ i }}-close" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="visibility: {{ 0 == i ? 'visible' : 'hidden' }}" />
16+
<img class="toggle" id="icon-{{ prefix ~ '-' ~ i }}-open" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="visibility: {{ 0 == i ? 'hidden' : 'visible' }}; margin-left: -18px" />
1717
</a>
1818
{% endspaceless %}
1919
<div id="trace-{{ prefix ~ '-' ~ i }}" style="display: {{ 0 == i ? 'block' : 'none' }}" class="trace">

src/Symfony/Bundle/TwigBundle/Resources/views/Exception/traces.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
{{ exception.class|abbr_class }}: {{ exception.message|nl2br|format_file_from_text }}&nbsp;
66
{% spaceless %}
77
<a href="#" onclick="toggle('traces-{{ position }}', 'traces'); switchIcons('icon-traces-{{ position }}-open', 'icon-traces-{{ position }}-close'); return false;">
8-
<img class="toggle" id="icon-traces-{{ position } F438 }-close" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="visibility: {{ 0 == count ? 'display' : 'hidden' }}" />
9-
<img class="toggle" id="icon-traces-{{ position }}-open" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="visibility: {{ 0 == count ? 'hidden' : 'display' }}; margin-left: -18px" />
8+
<img class="toggle" id="icon-traces-{{ position }}-close" alt="-" src="data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=" style="visibility: {{ 0 == count ? 'visible' : 'hidden' }}" />
9+
<img class="toggle" id="icon-traces-{{ position }}-open" alt="+" src="data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7" style="visibility: {{ 0 == count ? 'hidden' : 'visible' }}; margin-left: -18px" />
1010
</a>
1111
{% endspaceless %}
1212
</h2>

src/Symfony/Component/Console/Formatter/OutputFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class OutputFormatter implements OutputFormatterInterface
2323
/**
2424
* The pattern to phrase the format.
2525
*/
26-
const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?:(?!\\\\?<).)*)#is';
26+
const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?: [^<\\\\]+ | (?!<(?:/?[a-z]|/>)). | .(?<=\\\\<) )*)#isx';
2727

2828
private $decorated;
2929
private $styles = array();

src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,26 @@ public function testNestedStyles()
7373
);
7474
}
7575

76+
public function testStyleMatchingNotGreedy()
77+
{
78+
$formatter = new OutputFormatter(true);
79+
80+
$this->assertEquals(
81+
"(\033[32m>=2.0,<2.3\033[0m)",
82+
$formatter->format('(<info>>=2.0,<2.3</info>)')
83+
);
84+
}
85+
86+
public function testStyleEscaping()
87+
{
88+
$formatter = new OutputFormatter(true);
89+
90+
$this->assertEquals(
91+
"(\033[32mz>=2.0,<a2.3\033[0m)",
92+
$formatter->format('(<info>'.$formatter->escape('z>=2.0,<a2.3').'</info>)')
93+
);
94+
}
95+
7696
public function testDeepNestedStyles()
7797
{
7898
$formatter = new OutputFormatter(true);

src/Symfony/Component/CssSelector/Tests/TokenizerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function testTokenizeWithQuotedStrings()
3434
{
3535
$this->assertEquals('foo[class=foo bar ]', $this->tokensToString($this->tokenizer->tokenize('foo[class="foo bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
3636
$this->assertEquals("foo[class=foo Abar ]", $this->tokensToString($this->tokenizer->tokenize('foo[class="foo \\65 bar"]')), '->tokenize() lexes an input string and returns an array of tokens');
37+
$this->assertEquals("img[alt= ]", $this->tokensToString($this->tokenizer->tokenize('img[alt=""]')), '->tokenize() lexes an input string and returns an array of tokens');
3738
}
3839

3940
/**

src/Symfony/Component/CssSelector/Tokenizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function tokenizeEscapedString($s, $pos)
129129
}
130130

131131
$result = substr($s, $start, $next - $start);
132-
if ('\\' === $result[strlen($result) - 1]) {
132+
if (strlen($result) > 0 && '\\' === $result[strlen($result) - 1]) {
133133
// next quote character is escaped
134134
$pos = $next + 1;
135135
continue;

src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private function processArguments(array $arguments, $inMethodCall = false)
8989

9090
// resolve invalid behavior
9191
if ($exists && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
92-
$arguments[$k] = new Reference($id);
92+
$arguments[$k] = new Reference($id, ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $argument->isStrict());
9393
} elseif (!$exists && ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) {
9494
$arguments[$k] = null;
9595
} elseif (!$exists && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) {

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 30 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -229,24 +229,7 @@ private function addServiceInlinedDefinitions($id, $definition)
229229
throw new ServiceCircularReferenceException($id, array($id));
230230
}
231231

232-
$arguments = array();
233-
foreach ($sDefinition->getArguments() as $argument) {
234-
$arguments[] = $this->dumpValue($argument);
235-
}
236-
237-
if (null !== $sDefinition->getFactoryMethod()) {
238-
if (null !== $sDefinition->getFactoryClass()) {
239-
$code .= sprintf(" \$%s = call_user_func(array(%s, '%s')%s);\n", $name, $this->dumpValue($sDefinition->getFactoryClass()), $sDefinition->getFactoryMethod(), count($arguments) > 0 ? ', '.implode(', ', $arguments) : '');
240-
} elseif (null !== $sDefinition->getFactoryService()) {
241-
$code .= sprintf(" \$%s = %s->%s(%s);\n", $name, $this->getServiceCall($sDefinition->getFactoryService()), $sDefinition->getFactoryMethod(), implode(', ', $arguments));
242-
} else {
243-
throw new RuntimeException('Factory service or factory class must be defined in service definition for '.$id);
244-
}
245-
} elseif (false !== strpos($class, '$')) {
246-
$code .= sprintf(" \$class = %s;\n \$%s = new \$class(%s);\n", $class, $name, implode(', ', $arguments));
247-
} else {
248-
$code .= sprintf(" \$%s = new \\%s(%s);\n", $name, substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
249-
}
232+
$code .= $this->addNewInstance($id, $sDefinition, '$'.$name, ' = ');
250233

251234
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
252235
$code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
@@ -297,11 +280,6 @@ private function addServiceInstance($id, $definition)
297280
throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id));
298281
}
299282

300-
$arguments = array();
301-
foreach ($definition->getArguments() as $value) {
302-
$arguments[] = $this->dumpValue($value);
303-
}
304-
305283
$simple = $this->isSimpleInstance($id, $definition);
306284

307285
$instantiation = '';
@@ -320,19 +298,7 @@ private function addServiceInstance($id, $definition)
320298
$instantiation .= ' = ';
321299
}
322300

323-
if (null !== $definition->getFactoryMethod()) {
324-
if (null !== $definition->getFactoryClass()) {
325-
$code = sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass()), $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : '');
326-
} elseif (null !== $definition->getFactoryService()) {
327-
$code = sprintf(" $return{$instantiation}%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService()), $definition->getFactoryMethod(), implode(', ', $arguments));
328-
} else {
329-
throw new RuntimeException('Factory method requires a factory service or factory class in service definition for '.$id);
330-
}
331-
} elseif (false !== strpos($class, '$')) {
332-
$code = sprintf(" \$class = %s;\n\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments));
333-
} else {
334-
$code = sprintf(" $return{$instantiation}new \\%s(%s);\n", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
335-
}
301+
$code = $this->addNewInstance($id, $definition, $return, $instantiation);
336302

337303
if (!$simple) {
338304
$code .= "\n";
@@ -611,6 +577,34 @@ private function addServices()
611577
return $publicServices.$aliasServices.$privateServices;
612578
}
613579

580+
private function addNewInstance($id, Definition $definition, $return, $instantiation)
581+
{
582+
$class = $this->dumpValue($definition->getClass());
583+
584+
$arguments = array();
585+
foreach ($definition->getArguments() as $value) {
586+
$arguments[] = $this->dumpValue($value);
587+
}
588+
589+
if (null !== $definition->getFactoryMethod()) {
590+
if (null !== $definition->getFactoryClass()) {
591+
return sprintf(" $return{$instantiation}call_user_func(array(%s, '%s')%s);\n", $this->dumpValue($definition->getFactoryClass()), $definition->getFactoryMethod(), $arguments ? ', '.implode(', ', $arguments) : '');
592+
}
593+
594+
if (null !== $definition->getFactoryService()) {
595+
return sprintf(" $return{$instantiation}%s->%s(%s);\n", $this->getServiceCall($definition->getFactoryService()), $definition->getFactoryMethod(), implode(', ', $arguments));
596+
}
597+
598+
throw new RuntimeException('Factory method requires a factory service or factory class in service definition for '.$id);
599+
}
600+
601+
if (false !== strpos($class, '$')) {
602+
return sprintf(" \$class = %s;\n\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments));
603+
}
604+
605+
return sprintf(" $return{$instantiation}new \\%s(%s);\n", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
606+
}
607+
614608
/**
615609
* Adds the class headers.
616610
*

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ public function testProcessRemovesPropertiesOnInvalid()
6161
$this->assertEquals(array(), $def->getProperties());
6262
}
6363

64+
public function testStrictFlagIsPreserved()
65+
{
66+
$container = new ContainerBuilder();
67+
$container->register('bar');
68+
$def = $container
69+
->register('foo')
70+
->addArgument(new Reference('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))
71+
;
72+
73+
$this->process($container);
74+
75+
$this->assertFalse($def->getArgument(0)->isStrict());
76+
}
77+
6478
protected function process(ContainerBuilder $container)
6579
{
6680
$pass = new ResolveInvalidReferencesPass();

src/Symfony/Component/Form/FormBuilder.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@ public function count()
204204
return count($this->children);
205205
}
206206

207+
/**
208+
* {@inheritdoc}
209+
*/
210+
public function getFormConfig()
211+
{
212+
$config = parent::getFormConfig();
213+
214+
$config->factory = null;
215+
$config->parent = null;
216+
$config->children = array();
217+
$config->unresolvedChildren = array();
218+
219+
return $config;
220+
}
221+
207222
/**
208223
* {@inheritdoc}
209224
*/

src/Symfony/Component/Form/Resources/translations/validators.da.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<target>Den oploadede fil var for stor. Opload venligst en mindre fil.</target>
1212
</trans-unit>
1313
<trans-unit id="30">
14-
<source>The CSRF token is invalid.</source>
14+
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
1515
<target>CSRF nøglen er ugyldig.</target>
1616
</trans-unit>
1717
</body>

src/Symfony/Component/Form/Tests/FormBuilderTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,30 @@ public function testGetParentForCreatedBuilder()
239239
$this->builder->create('bar', 'text');
240240
}
241241

242+
public function testGetFormConfigErasesReferences()
243+
{
244+
$builder = new FormBuilder('name', null, $this->dispatcher, $this->factory);
245+
$builder->setParent(new FormBuilder('parent', null, $this->dispatcher, $this->factory));
246+
$builder->add(new FormBuilder('child', null, $this->dispatcher, $this->factory));
247+
248+
$config = $builder->getFormConfig();
249+
$reflClass = new \ReflectionClass($config);
250+
$factory = $reflClass->getProperty('factory');
251+
$parent = $reflClass->getProperty('parent');
252+
$children = $reflClass->getProperty('children');
253+
$unresolvedChildren = $reflClass->getProperty('unresolvedChildren');
254+
255+
$factory->setAccessible(true);
256+
$parent->setAccessible(true);
257+
$children->setAccessible(true);
258+
$unresolvedChildren->setAccessible(true);
259+
260+
$this->assertNull($factory->getValue($config));
261+
$this->assertNull($parent->getValue($config));
262+
$this->assertEmpty($children->getValue($config));
263+
$this->assertEmpty($unresolvedChildren->getValue($config));
264+
}
265+
242266
private function getFormBuilder($name = 'name')
243267
{
244268
$mock = $this->getMockBuilder('Symfony\Component\Form\FormBuilder')

src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct($cmd = 'file -b --mime %s 2>/dev/null')
4545
*/
4646
public static function isSupported()
4747
{
48-
return !defined('PHP_WINDOWS_VERSION_BUILD');
48+
return !defined('PHP_WINDOWS_VERSION_BUILD') && function_exists('passthru') && function_exists('escapeshellarg');
4949
}
5050

5151
/**

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,8 @@ public function getAcceptableContentTypes()
14041404
* Returns true if the request is a XMLHttpRequest.
14051405
*
14061406
* It works if your JavaScript library set an X-Requested-With HTTP header.
1407-
* It is known to work with Prototype, Mootools, jQuery.
1407+
* It is known to work with common JavaScript frameworks:
1408+
* @link http://en.wikipedia.org/wiki/List_of_Ajax_frameworks#JavaScript
14081409
*
14091410
* @return Boolean true if the request is an XMLHttpRequest, false otherwise
14101411
*

src/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ public function getIterator()
177177
/**
178178
* Returns the number of flashes.
179179
*
180+
* This method does not work.
181+
*
182+
* @deprecated in 2.2, removed in 2.3
183+
* @see https://github.com/symfony/symfony/issues/6408
184+
*
180185
* @return int The number of flashes
181186
*/
182187
public function count()

src/Symfony/Component/Security/Tests/Core/Util/ClassUtilsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class ClassUtilsTest extends \PHPUnit_Framework_TestCase
1717
{
18-
static public function dataGetClass()
18+
public static function dataGetClass()
1919
{
2020
return array(
2121
array('stdClass', 'stdClass'),

0 commit comments

Comments
 (0)
0