Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '2.1' into 2.2

* 2.1:
  #7106 - fix for ZTS builds
  Added '@@' escaping strategy for YamlFileLoader and YamlDumper
  [Yaml] fixed bugs with folded scalar parsing
  [Form] made DefaultCsrfProvider using session_status() when available
  Added unit tests to Dumper
  Update .travis.yml (closes #7355)
  [HttpFoudantion] fixed Request::getPreferredLanguage()
  Revert "merged branch jfsimon/issue-6928 (PR #7378)"
  Routing issue with installation in a sub-directory ref: symfony/symfony#7129

Conflicts:
	.travis.yml
	src/Symfony/Bundle/FrameworkBundle/Routing/Router.php
	src/Symfony/Component/Routing/RouteCollection.php
  • Loading branch information...
commit 31af8414b83037ae59d72da62004fe89c01c4e79 2 parents 847f610 + 07a4b55
@fabpot fabpot authored
View
2  Dumper/YamlDumper.php
@@ -260,7 +260,7 @@ private function prepareParameters($parameters, $escape = true)
foreach ($parameters as $key => $value) {
if (is_array($value)) {
$value = $this->prepareParameters($value, $escape);
- } elseif ($value instanceof Reference) {
+ } elseif ($value instanceof Reference || is_string($value) && 0 === strpos($value, '@')) {
$value = '@'.$value;
}
View
9 Loader/YamlFileLoader.php
@@ -290,7 +290,10 @@ private function resolveServices($value)
if (is_array($value)) {
$value = array_map(array($this, 'resolveServices'), $value);
} elseif (is_string($value) && 0 === strpos($value, '@')) {
- if (0 === strpos($value, '@?')) {
+ if (0 === strpos($value, '@@')) {
+ $value = substr($value, 1);
+ $invalidBehavior = null;
+ } elseif (0 === strpos($value, '@?')) {
$value = substr($value, 2);
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
} else {
@@ -305,7 +308,9 @@ private function resolveServices($value)
$strict = true;
}
- $value = new Reference($value, $invalidBehavior, $strict);
+ if (null !== $invalidBehavior) {
+ $value = new Reference($value, $invalidBehavior, $strict);
+ }
}
return $value;
View
1  Tests/Fixtures/containers/container8.php
@@ -7,6 +7,7 @@
'FOO' => '%baz%',
'baz' => 'bar',
'bar' => 'foo is %%foo bar',
+ 'escape' => '@escapeme',
'values' => array(true, false, null, 0, 1000.3, 'true', 'false', 'null'),
)));
View
1  Tests/Fixtures/php/services8.php
@@ -37,6 +37,7 @@ protected function getDefaultParameters()
'foo' => '%baz%',
'baz' => 'bar',
'bar' => 'foo is %%foo bar',
+ 'escape' => '@escapeme',
'values' => array(
0 => true,
1 => false,
View
1  Tests/Fixtures/xml/services8.xml
@@ -7,6 +7,7 @@
<parameter key="foo">%baz%</parameter>
<parameter key="baz">bar</parameter>
<parameter key="bar">foo is %%foo bar</parameter>
+ <parameter key="escape">@escapeme</parameter>
<parameter key="values" type="collection">
<parameter>true</parameter>
<parameter>false</parameter>
View
1  Tests/Fixtures/yaml/services2.yml
@@ -6,6 +6,7 @@ parameters:
- 0
- 1000.3
bar: foo
+ escape: @@escapeme
foo_bar: @foo_bar
MixedCase:
MixedCaseKey: value
View
1  Tests/Fixtures/yaml/services8.yml
@@ -2,5 +2,6 @@ parameters:
foo: '%baz%'
baz: bar
bar: 'foo is %%foo bar'
+ escape: '@@escapeme'
values: [true, false, null, 0, 1000.3, 'true', 'false', 'null']
View
4 Tests/Loader/YamlFileLoaderTest.php
@@ -84,7 +84,7 @@ public function testLoadParameters()
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
$loader->load('services2.yml');
- $this->assertEquals(array('foo' => 'bar', 'mixedcase' => array('MixedCaseKey' => 'value'), 'values' => array(true, false, 0, 1000.3), 'bar' => 'foo', 'foo_bar' => new Reference('foo_bar')), $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase');
+ $this->assertEquals(array('foo' => 'bar', 'mixedcase' => array('MixedCaseKey' => 'value'), 'values' => array(true, false, 0, 1000.3), 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')), $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase');
}
public function testLoadImports()
@@ -99,7 +99,7 @@ public function testLoadImports()
$loader->load('services4.yml');
$actual = $container->getParameterBag()->all();
- $expected = array('foo' => 'bar', 'values' => array(true, false), 'bar' => '%foo%', 'foo_bar' => new Reference('foo_bar'), 'mixedcase' => array('MixedCaseKey' => 'value'), 'imported_from_ini' => true, 'imported_from_xml' => true);
+ $expected = array('foo' => 'bar', 'values' => array(true, false), 'bar' => '%foo%', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar'), 'mixedcase' => array('MixedCaseKey' => 'value'), 'imported_from_ini' => true, 'imported_from_xml' => true);
$this->assertEquals(array_keys($expected), array_keys($actual), '->load() imports and merges imported files');
// Bad import throws no exception due to ignore_errors value.
Please sign in to comment.
Something went wrong with that request. Please try again.