8000 Merge branch '2.3' into 2.7 · symfony/symfony@c91638f · GitHub
[go: up one dir, main page]

Skip to content

Commit c91638f

Browse files
Merge branch '2.3' into 2.7
* 2.3: Sent out a status text for unknown HTTP headers. [DependencyInjection] Unescape parameters for all types of injection
2 parents 16fb701 + 3dc2244 commit c91638f

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ public function createService(Definition $definition, $id, $tryProxy = true)
901901
$this->callMethod($service, $call);
902902
}
903903

904-
$properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties()));
904+
$properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())));
905905
foreach ($properties as $name => $value) {
906906
$service->$name = $value;
907907
}
@@ -1088,7 +1088,7 @@ private function callMethod($service, $call)
10881088
}
10891089
}
10901090

1091-
call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1])));
1091+
call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1]))));
10921092
}
10931093

10941094
/**

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,24 @@ public function testCreateServiceMethodCalls()
320320
$this->assertEquals(array('bar', $builder->get('bar')), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments');
321321
}
322322

323+
public function testCreateServiceMethodCallsWithEscapedParam()
324+
{
325+
$builder = new ContainerBuilder();
326+
$builder->register('bar', 'stdClass');
327+
$builder->register('foo1', 'FooClass')->addMethodCall('setBar', array(array('%%unescape_it%%')));
328+
$builder->setParameter('value', 'bar');
329+
$this->assertEquals(array('%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments');
330+
}
331+
332+
public function testCreateServiceProperties()
333+
{
334+
$builder = new ContainerBuilder();
335+
$builder->register('bar', 'stdClass');
336+
$builder->register('foo1', 'FooClass')->setProperty('bar', array('%value%', new Reference('bar'), '%%unescape_it%%'));
337+
$builder->setParameter('value', 'bar');
338+
$this->assertEquals(array('bar', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the properties');
339+
}
340+
323341
public function testCreateServiceConfigurator()
324342
{
325343
$builder = new ContainerBuilder();

src/Symfony/Component/HttpFoundation/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public function setStatusCode($code, $text = null)
455455
}
456456

457457
if (null === $text) {
458-
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : '';
458+
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status';
459459

460460
return $this;
461461
}

src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ public function getStatusCodeFixtures()
695695
array('200', null, 'OK'),
696696
array('200', false, ''),
697697
array('200', 'foo', 'foo'),
698-
array('199', null, ''),
698+
array('199', null, 'unknown status'),
699699
array('199', false, ''),
700700
array('199', 'foo', 'foo'),
701701
);

0 commit comments

Comments
 (0)
0