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
This commit is contained in:
commit
fe6e9e4543
@ -936,7 +936,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
$this->callMethod($service, $call);
|
||||
}
|
||||
|
||||
$properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties()));
|
||||
$properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())));
|
||||
foreach ($properties as $name => $value) {
|
||||
$service->$name = $value;
|
||||
}
|
||||
@ -1134,7 +1134,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
}
|
||||
}
|
||||
|
||||
call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1])));
|
||||
call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1]))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -355,6 +355,24 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array('bar', $builder->get('bar')), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments');
|
||||
}
|
||||
|
||||
public function testCreateServiceMethodCallsWithEscapedParam()
|
||||
{
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->register('bar', 'stdClass');
|
||||
$builder->register('foo1', 'FooClass')->addMethodCall('setBar', array(array('%%unescape_it%%')));
|
||||
$builder->setParameter('value', 'bar');
|
||||
$this->assertEquals(array('%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the method calls arguments');
|
||||
}
|
||||
|
||||
public function testCreateServiceProperties()
|
||||
{
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->register('bar', 'stdClass');
|
||||
$builder->register('foo1', 'FooClass')->setProperty('bar', array('%value%', new Reference('bar'), '%%unescape_it%%'));
|
||||
$builder->setParameter('value', 'bar');
|
||||
$this->assertEquals(array('bar', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->bar, '->createService() replaces the values in the properties');
|
||||
}
|
||||
|
||||
public function testCreateServiceConfigurator()
|
||||
{
|
||||
$builder = new ContainerBuilder();
|
||||
|
@ -455,7 +455,7 @@ class Response
|
||||
}
|
||||
|
||||
if (null === $text) {
|
||||
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : '';
|
||||
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ class ResponseTest extends ResponseTestCase
|
||||
array('200', null, 'OK'),
|
||||
array('200', false, ''),
|
||||
array('200', 'foo', 'foo'),
|
||||
array('199', null, ''),
|
||||
array('199', null, 'unknown status'),
|
||||
array('199', false, ''),
|
||||
array('199', 'foo', 'foo'),
|
||||
);
|
||||
|
Reference in New Issue
Block a user