Merge branch '2.7' into 2.8
* 2.7: [php7] Fix for substr() always returning a string [Security] Do not save the target path in the session for a stateless firewall Fix calls to HttpCache#getSurrogate triggering E_USER_DEPRECATED errors. [DependencyInjection] fixed FrozenParameterBag and improved Parameter…
This commit is contained in:
commit
2655072bfd
@ -366,7 +366,7 @@ class SecurityExtension extends Extension
|
|||||||
$listeners[] = new Reference('security.access_listener');
|
$listeners[] = new Reference('security.access_listener');
|
||||||
|
|
||||||
// Exception listener
|
// Exception listener
|
||||||
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint));
|
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint, $firewall['stateless']));
|
||||||
|
|
||||||
return array($matcher, $listeners, $exceptionListener);
|
return array($matcher, $listeners, $exceptionListener);
|
||||||
}
|
}
|
||||||
@ -551,12 +551,13 @@ class SecurityExtension extends Extension
|
|||||||
return 'security.user.provider.concrete.'.$name;
|
return 'security.user.provider.concrete.'.$name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createExceptionListener($container, $config, $id, $defaultEntryPoint)
|
private function createExceptionListener($container, $config, $id, $defaultEntryPoint, $stateless)
|
||||||
{
|
{
|
||||||
$exceptionListenerId = 'security.exception_listener.'.$id;
|
$exceptionListenerId = 'security.exception_listener.'.$id;
|
||||||
$listener = $container->setDefinition($exceptionListenerId, new DefinitionDecorator('security.exception_listener'));
|
$listener = $container->setDefinition($exceptionListenerId, new DefinitionDecorator('security.exception_listener'));
|
||||||
$listener->replaceArgument(3, $id);
|
$listener->replaceArgument(3, $id);
|
||||||
$listener->replaceArgument(4, null === $defaultEntryPoint ? null : new Reference($defaultEntryPoint));
|
$listener->replaceArgument(4, null === $defaultEntryPoint ? null : new Reference($defaultEntryPoint));
|
||||||
|
$listener->replaceArgument(8, $stateless);
|
||||||
|
|
||||||
// access denied handler setup
|
// access denied handler setup
|
||||||
if (isset($config['access_denied_handler'])) {
|
if (isset($config['access_denied_handler'])) {
|
||||||
|
@ -244,6 +244,7 @@
|
|||||||
<argument>%security.access.denied_url%</argument>
|
<argument>%security.access.denied_url%</argument>
|
||||||
<argument type="service" id="security.access.denied_handler" on-invalid="null" />
|
<argument type="service" id="security.access.denied_handler" on-invalid="null" />
|
||||||
<argument type="service" id="logger" on-invalid="null" />
|
<argument type="service" id="logger" on-invalid="null" />
|
||||||
|
<argument>false</argument> <!-- Stateless -->
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="security.authentication.switchuser_listener" class="%security.authentication.switchuser_listener.class%" public="false" abstract="true">
|
<service id="security.authentication.switchuser_listener" class="%security.authentication.switchuser_listener.class%" public="false" abstract="true">
|
||||||
|
@ -215,8 +215,8 @@ class ArgvInput extends Input
|
|||||||
|
|
||||||
$option = $this->definition->getOption($name);
|
$option = $this->definition->getOption($name);
|
||||||
|
|
||||||
// Convert false values (from a previous call to substr()) to null
|
// Convert empty values to null
|
||||||
if (false === $value) {
|
if (!isset($value[0])) {
|
||||||
$value = null;
|
$value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ class SymfonyStyle extends OutputStyle
|
|||||||
{
|
{
|
||||||
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
||||||
|
|
||||||
if (false === $chars) {
|
if (!isset($chars[0])) {
|
||||||
return $this->newLine(); //empty history, so we should start with a new line.
|
return $this->newLine(); //empty history, so we should start with a new line.
|
||||||
}
|
}
|
||||||
//Prepend new line for each non LF chars (This means no blank line was output before)
|
//Prepend new line for each non LF chars (This means no blank line was output before)
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\DependencyInjection\ParameterBag;
|
namespace Symfony\Component\DependencyInjection\ParameterBag;
|
||||||
|
|
||||||
|
use Symfony\Component\DependencyInjection\Exception\LogicException;
|
||||||
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
|
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,6 +26,8 @@ interface ParameterBagInterface
|
|||||||
/**
|
/**
|
||||||
* Clears all parameters.
|
* Clears all parameters.
|
||||||
*
|
*
|
||||||
|
* @throws LogicException if the ParameterBagInterface can not be cleared
|
||||||
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function clear();
|
public function clear();
|
||||||
@ -34,6 +37,8 @@ interface ParameterBagInterface
|
|||||||
*
|
*
|
||||||
* @param array $parameters An array of parameters
|
* @param array $parameters An array of parameters
|
||||||
*
|
*
|
||||||
|
* @throws LogicException if the parameter can not be added
|
||||||
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function add(array $parameters);
|
public function add(array $parameters);
|
||||||
@ -66,6 +71,8 @@ interface ParameterBagInterface
|
|||||||
* @param string $name The parameter name
|
* @param string $name The parameter name
|
||||||
* @param mixed $value The parameter value
|
* @param mixed $value The parameter value
|
||||||
*
|
*
|
||||||
|
* @throws LogicException if the parameter can not be set
|
||||||
|
*
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
public function set($name, $value);
|
public function set($name, $value);
|
||||||
|
@ -57,4 +57,13 @@ class FrozenParameterBagTest extends \PHPUnit_Framework_TestCase
|
|||||||
$bag = new FrozenParameterBag(array());
|
$bag = new FrozenParameterBag(array());
|
||||||
$bag->add(array());
|
$bag->add(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \LogicException
|
||||||
|
*/
|
||||||
|
public function testRemove()
|
||||||
|
{
|
||||||
|
$bag = new FrozenParameterBag(array('foo' => 'bar'));
|
||||||
|
$bag->remove('foo');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,11 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
*/
|
*/
|
||||||
public function getSurrogate()
|
public function getSurrogate()
|
||||||
{
|
{
|
||||||
return $this->getEsi();
|
if (!$this->surrogate instanceof Esi) {
|
||||||
|
throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->surrogate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,11 +180,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
|
|||||||
{
|
{
|
||||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getSurrogate() method instead.', E_USER_DEPRECATED);
|
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getSurrogate() method instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
if (!$this->surrogate instanceof Esi) {
|
return $this->getSurrogate();
|
||||||
throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->surrogate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,8 +47,9 @@ class ExceptionListener
|
|||||||
private $errorPage;
|
private $errorPage;
|
||||||
private $logger;
|
private $logger;
|
||||||
private $httpUtils;
|
private $httpUtils;
|
||||||
|
private $stateless;
|
||||||
|
|
||||||
public function __construct(TokenStorageInterface $tokenStorage, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null)
|
public function __construct(TokenStorageInterface $tokenStorage, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null, $stateless = false)
|
||||||
{
|
{
|
||||||
$this->tokenStorage = $tokenStorage;
|
$this->tokenStorage = $tokenStorage;
|
||||||
$this->accessDeniedHandler = $accessDeniedHandler;
|
$this->accessDeniedHandler = $accessDeniedHandler;
|
||||||
@ -58,6 +59,7 @@ class ExceptionListener
|
|||||||
$this->authenticationTrustResolver = $trustResolver;
|
$this->authenticationTrustResolver = $trustResolver;
|
||||||
$this->errorPage = $errorPage;
|
$this->errorPage = $errorPage;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
$this->stateless = $stateless;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,7 +187,9 @@ class ExceptionListener
|
|||||||
$this->logger->debug('Calling Authentication entry point.');
|
$this->logger->debug('Calling Authentication entry point.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setTargetPath($request);
|
if (!$this->stateless) {
|
||||||
|
$this->setTargetPath($request);
|
||||||
|
}
|
||||||
|
|
||||||
if ($authException instanceof AccountStatusException) {
|
if ($authException instanceof AccountStatusException) {
|
||||||
// remove the security token to prevent infinite redirect loops
|
// remove the security token to prevent infinite redirect loops
|
||||||
|
@ -32,7 +32,7 @@ ReflectionClass {
|
|||||||
constants: array:3 [
|
constants: array:3 [
|
||||||
"IS_IMPLICIT_ABSTRACT" => 16
|
"IS_IMPLICIT_ABSTRACT" => 16
|
||||||
"IS_EXPLICIT_ABSTRACT" => 32
|
"IS_EXPLICIT_ABSTRACT" => 32
|
||||||
"IS_FINAL" => 64
|
"IS_FINAL" => %d
|
||||||
]
|
]
|
||||||
properties: array:%d [
|
properties: array:%d [
|
||||||
"name" => ReflectionProperty {
|
"name" => ReflectionProperty {
|
||||||
|
@ -356,7 +356,7 @@ class Parser
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($inSequence && $oldLineIndentation === $newIndent && '-' === $data[0][0]) {
|
if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) {
|
||||||
// the previous line contained a dash but no item content, this line is a sequence item with the same indentation
|
// the previous line contained a dash but no item content, this line is a sequence item with the same indentation
|
||||||
// and therefore no nested list or mapping
|
// and therefore no nested list or mapping
|
||||||
$this->moveToPreviousLine();
|
$this->moveToPreviousLine();
|
||||||
|
Reference in New Issue
Block a user