Skip to content

Commit fe6e9e4

Browse files
Merge branch '2.7' into 2.8
* 2.7: Sent out a status text for unknown HTTP headers. [DependencyInjection] Unescape parameters for all types of injection
2 parents 02c31ad + c91638f commit fe6e9e4

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ public function createService(Definition $definition, $id, $tryProxy = true)
936936
$this->callMethod($service, $call);
937937
}
938938

939-
$properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties()));
939+
$properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())));
940940
foreach ($properties as $name => $value) {
941941
$service->$name = $value;
942942
}
@@ -1134,7 +1134,7 @@ private function callMethod($service, $call)
11341134
}
11351135
}
11361136

1137-
call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1])));
1137+
call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1]))));
11381138
}
11391139

11401140
/**

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

+18
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,24 @@ public function testCreateServiceMethodCalls()
355355
$this->assertEquals(array('bar', $builder->get('bar')), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments');
356356
}
357357

358+
public function testCreateServiceMethodCallsWithEscapedParam()
359+
{
360+
$builder = new ContainerBuilder();
361+
$builder->register('bar', 'stdClass');
362+
$builder->register('foo1', 'FooClass')->addMethodCall('setBar', array(array('%%unescape_it%%')));
363+
$builder->setParameter('value', 'bar');
364+
$this->assertEquals(array('%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments');
365+
}
366+
367+
public function testCreateServiceProperties()
368+
{
369+
$builder = new ContainerBuilder();
370+
$builder->register('bar', 'stdClass');
371+
$builder->register('foo1', 'FooClass')->setProperty('bar', array('%value%', new Reference('bar'), '%%unescape_it%%'));
372+
$builder->setParameter('value', 'bar');
373+
$this->assertEquals(array('bar', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the properties');
374+
}
375+
358376
public function testCreateServiceConfigurator()
359377
{
360378
$builder = new ContainerBuilder();

src/Symfony/Component/HttpFoundation/Response.php

+1-1
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

+1-1
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)