Remove various legacy code paths
This commit is contained in:
parent
ba40486dbf
commit
ccbe132d3b
@ -10,6 +10,8 @@ CHANGELOG
|
||||
* The `SimpleFormFactory` and `SimplePreAuthenticationFactory` classes have been removed,
|
||||
use Guard instead.
|
||||
* Removed `LogoutUrlHelper` and `SecurityHelper` templating helpers, use Twig instead
|
||||
* Removed the `logout_on_user_change` firewall option
|
||||
* Removed the `threads` encoder option
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
@ -205,11 +205,6 @@ class MainConfiguration implements ConfigurationInterface
|
||||
->scalarNode('provider')->end()
|
||||
->booleanNode('stateless')->defaultFalse()->end()
|
||||
->scalarNode('context')->cannotBeEmpty()->end()
|
||||
->booleanNode('logout_on_user_change')
|
||||
->defaultTrue()
|
||||
->info('When true, it will trigger a logout for the user if something has changed. Note: No-Op option since 4.0. Will always be true.')
|
||||
->setDeprecated('The "%path%.%node%" configuration key has been deprecated in Symfony 4.1.')
|
||||
->end()
|
||||
->arrayNode('logout')
|
||||
->treatTrueLike([])
|
||||
->canBeUnset()
|
||||
@ -415,10 +410,6 @@ class MainConfiguration implements ConfigurationInterface
|
||||
->end()
|
||||
->scalarNode('memory_cost')->defaultNull()->end()
|
||||
->scalarNode('time_cost')->defaultNull()->end()
|
||||
->scalarNode('threads')
|
||||
->defaultNull()
|
||||
->setDeprecated('The "%path%.%node%" configuration key has no effect since Symfony 4.3 and will be removed in 5.0.')
|
||||
->end()
|
||||
->scalarNode('id')->end()
|
||||
->end()
|
||||
->end()
|
||||
|
@ -51,6 +51,7 @@ class TraceableFirewallListenerTest extends TestCase
|
||||
->willReturn([[$listener], null, null]);
|
||||
|
||||
$firewall = new TraceableFirewallListener($firewallMap, new EventDispatcher(), new LogoutUrlGenerator());
|
||||
$firewall->configureLogoutUrlGenerator($event);
|
||||
$firewall->onKernelRequest($event);
|
||||
|
||||
$listeners = $firewall->getWrappedListeners();
|
||||
|
@ -285,7 +285,6 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
'cost' => null,
|
||||
'memory_cost' => null,
|
||||
'time_cost' => null,
|
||||
'threads' => null,
|
||||
],
|
||||
'JMS\FooBundle\Entity\User3' => [
|
||||
'algorithm' => 'md5',
|
||||
@ -297,7 +296,6 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
'cost' => null,
|
||||
'memory_cost' => null,
|
||||
'time_cost' => null,
|
||||
'threads' => null,
|
||||
],
|
||||
'JMS\FooBundle\Entity\User4' => new Reference('security.encoder.foo'),
|
||||
'JMS\FooBundle\Entity\User5' => [
|
||||
@ -318,7 +316,6 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
'cost' => null,
|
||||
'memory_cost' => null,
|
||||
'time_cost' => null,
|
||||
'threads' => null,
|
||||
],
|
||||
]], $container->getDefinition('security.encoder_factory.generic')->getArguments());
|
||||
}
|
||||
@ -346,7 +343,6 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
'cost' => null,
|
||||
'memory_cost' => null,
|
||||
'time_cost' => null,
|
||||
'threads' => null,
|
||||
],
|
||||
'JMS\FooBundle\Entity\User3' => [
|
||||
'algorithm' => 'md5',
|
||||
@ -358,7 +354,6 @@ abstract class CompleteConfigurationTest extends TestCase
|
||||
'cost' => null,
|
||||
'memory_cost' => null,
|
||||
'time_cost' => null,
|
||||
'threads' => null,
|
||||
],
|
||||
'JMS\FooBundle\Entity\User4' => new Reference('security.encoder.foo'),
|
||||
'JMS\FooBundle\Entity\User5' => [
|
||||
|
@ -3,8 +3,10 @@ CHANGELOG
|
||||
|
||||
5.0.0
|
||||
-----
|
||||
|
||||
* Dropped support for constructing a `TreeBuilder` without passing root node information.
|
||||
* Removed the `root()` method in `TreeBuilder`, pass the root node information to the constructor instead
|
||||
* Added method `getChildNodeDefinitions()` to ParentNodeDefinitionInterface
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
@ -15,8 +15,6 @@ namespace Symfony\Component\Config\Definition\Builder;
|
||||
* An interface that must be implemented by nodes which can have children.
|
||||
*
|
||||
* @author Victor Berchet <victor@suumit.com>
|
||||
*
|
||||
* @method NodeDefinition[] getChildNodeDefinitions() Gets the child node definitions - not implementing it is deprecated since Symfony 4.2
|
||||
*/
|
||||
interface ParentNodeDefinitionInterface extends BuilderAwareInterface
|
||||
{
|
||||
@ -43,4 +41,11 @@ interface ParentNodeDefinitionInterface extends BuilderAwareInterface
|
||||
* @return $this
|
||||
*/
|
||||
public function append(NodeDefinition $node);
|
||||
|
||||
/**
|
||||
* Gets the child node definitions.
|
||||
*
|
||||
* @return NodeDefinition[]
|
||||
*/
|
||||
public function getChildNodeDefinitions();
|
||||
}
|
||||
|
@ -35,14 +35,8 @@ class FileType extends AbstractType
|
||||
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* @param TranslatorInterface|null $translator
|
||||
*/
|
||||
public function __construct($translator = null)
|
||||
public function __construct(TranslatorInterface $translator = null)
|
||||
{
|
||||
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
|
||||
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
|
||||
}
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Component\Form\Event\PostSetDataEvent;
|
||||
use Symfony\Component\Form\Event\PostSubmitEvent;
|
||||
use Symfony\Component\Form\Event\PreSetDataEvent;
|
||||
@ -334,7 +333,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
}
|
||||
|
||||
$this->lockSetData = true;
|
||||
$dispatcher = LegacyEventDispatcherProxy::decorate($this->config->getEventDispatcher());
|
||||
$dispatcher = $this->config->getEventDispatcher();
|
||||
|
||||
// Hook to change content of the model data before transformation and mapping children
|
||||
if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA)) {
|
||||
@ -541,7 +540,7 @@ class Form implements \IteratorAggregate, FormInterface, ClearableErrorsInterfac
|
||||
$this->transformationFailure = new TransformationFailedException('Submitted data was expected to be text or number, array given.');
|
||||
}
|
||||
|
||||
$dispatcher = LegacyEventDispatcherProxy::decorate($this->config->getEventDispatcher());
|
||||
$dispatcher = $this->config->getEventDispatcher();
|
||||
|
||||
$modelData = null;
|
||||
$normData = null;
|
||||
|
@ -17,6 +17,8 @@ CHANGELOG
|
||||
* removed `GetResponseForExceptionEvent`, use `ExceptionEvent` instead
|
||||
* removed `PostResponseEvent`, use `TerminateEvent` instead
|
||||
* removed `SaveSessionListener` in favor of `AbstractSessionListener`
|
||||
* removed `Client`, use `HttpKernelBrowser` instead
|
||||
* added method `getProjectDir()` to `KernelInterface`
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
@ -1,201 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\BrowserKit\AbstractBrowser;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\Request as DomRequest;
|
||||
use Symfony\Component\BrowserKit\Response as DomResponse;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Client simulates a browser and makes requests to an HttpKernel instance.
|
||||
*
|
||||
* @deprecated since Symfony 4.3, use HttpKernelBrowser instead.
|
||||
*/
|
||||
class Client extends AbstractBrowser
|
||||
{
|
||||
protected $kernel;
|
||||
private $catchExceptions = true;
|
||||
|
||||
/**
|
||||
* @param HttpKernelInterface $kernel An HttpKernel instance
|
||||
* @param array $server The server parameters (equivalent of $_SERVER)
|
||||
* @param History $history A History instance to store the browser history
|
||||
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
|
||||
{
|
||||
// These class properties must be set before calling the parent constructor, as it may depend on it.
|
||||
$this->kernel = $kernel;
|
||||
$this->followRedirects = false;
|
||||
|
||||
parent::__construct($server, $history, $cookieJar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to catch exceptions when the kernel is handling a request.
|
||||
*
|
||||
* @param bool $catchExceptions Whether to catch exceptions
|
||||
*/
|
||||
public function catchExceptions($catchExceptions)
|
||||
{
|
||||
$this->catchExceptions = $catchExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request.
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
protected function doRequest($request)
|
||||
{
|
||||
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions);
|
||||
|
||||
if ($this->kernel instanceof TerminableInterface) {
|
||||
$this->kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the script to execute when the request must be insulated.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getScript($request)
|
||||
{
|
||||
$kernel = var_export(serialize($this->kernel), true);
|
||||
$request = var_export(serialize($request), true);
|
||||
|
||||
$errorReporting = error_reporting();
|
||||
|
||||
$requires = '';
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= 'require_once '.var_export($file, true).";\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$requires) {
|
||||
throw new \RuntimeException('Composer autoloader not found.');
|
||||
}
|
||||
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
error_reporting($errorReporting);
|
||||
|
||||
$requires
|
||||
|
||||
\$kernel = unserialize($kernel);
|
||||
\$request = unserialize($request);
|
||||
EOF;
|
||||
|
||||
return $code.$this->getHandleScript();
|
||||
}
|
||||
|
||||
protected function getHandleScript()
|
||||
{
|
||||
return <<<'EOF'
|
||||
$response = $kernel->handle($request);
|
||||
|
||||
if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) {
|
||||
$kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
echo serialize($response);
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the BrowserKit request to a HttpKernel request.
|
||||
*
|
||||
* @return Request A Request instance
|
||||
*/
|
||||
protected function filterRequest(DomRequest $request)
|
||||
{
|
||||
$httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent());
|
||||
|
||||
foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) {
|
||||
$httpRequest->files->set($key, $value);
|
||||
}
|
||||
|
||||
return $httpRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters an array of files.
|
||||
*
|
||||
* This method created test instances of UploadedFile so that the move()
|
||||
* method can be called on those instances.
|
||||
*
|
||||
* If the size of a file is greater than the allowed size (from php.ini) then
|
||||
* an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
|
||||
*
|
||||
* @see UploadedFile
|
||||
*
|
||||
* @return array An array with all uploaded files marked as already moved
|
||||
*/
|
||||
protected function filterFiles(array $files)
|
||||
{
|
||||
$filtered = [];
|
||||
foreach ($files as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
$filtered[$key] = $this->filterFiles($value);
|
||||
} elseif ($value instanceof UploadedFile) {
|
||||
if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
'',
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
UPLOAD_ERR_INI_SIZE,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
$value->getPathname(),
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
$value->getError(),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the HttpKernel response to a BrowserKit response.
|
||||
*
|
||||
* @return DomResponse A DomResponse instance
|
||||
*/
|
||||
protected function filterResponse($response)
|
||||
{
|
||||
// this is needed to support StreamedResponse
|
||||
ob_start();
|
||||
$response->sendContent();
|
||||
$content = ob_get_clean();
|
||||
|
||||
return new DomResponse($content, $response->getStatusCode(), $response->headers->all());
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\Fragment;
|
||||
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||
@ -34,7 +33,7 @@ class InlineFragmentRenderer extends RoutableFragmentRenderer
|
||||
public function __construct(HttpKernelInterface $kernel, EventDispatcherInterface $dispatcher = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
@ -47,7 +46,7 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
|
||||
public function __construct(EventDispatcherInterface $dispatcher, ControllerResolverInterface $resolver, RequestStack $requestStack = null, ArgumentResolverInterface $argumentResolver = null)
|
||||
{
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->resolver = $resolver;
|
||||
$this->requestStack = $requestStack ?: new RequestStack();
|
||||
$this->argumentResolver = $argumentResolver;
|
||||
|
@ -11,17 +11,194 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\BrowserKit\AbstractBrowser;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\Request as DomRequest;
|
||||
use Symfony\Component\BrowserKit\Response as DomResponse;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Client simulates a browser and makes requests to an HttpKernel instance.
|
||||
* Simulates a browser and makes requests to an HttpKernel instance.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @method Request getRequest() A Request instance
|
||||
* @method Response getResponse() A Response instance
|
||||
*/
|
||||
class HttpKernelBrowser extends Client
|
||||
class HttpKernelBrowser extends AbstractBrowser
|
||||
{
|
||||
protected $kernel;
|
||||
private $catchExceptions = true;
|
||||
|
||||
/**
|
||||
* @param HttpKernelInterface $kernel An HttpKernel instance
|
||||
* @param array $server The server parameters (equivalent of $_SERVER)
|
||||
* @param History $history A History instance to store the browser history
|
||||
* @param CookieJar $cookieJar A CookieJar instance to store the cookies
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
|
||||
{
|
||||
// These class properties must be set before calling the parent constructor, as it may depend on it.
|
||||
$this->kernel = $kernel;
|
||||
$this->followRedirects = false;
|
||||
|
||||
parent::__construct($server, $history, $cookieJar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether to catch exceptions when the kernel is handling a request.
|
||||
*
|
||||
* @param bool $catchExceptions Whether to catch exceptions
|
||||
*/
|
||||
public function catchExceptions($catchExceptions)
|
||||
{
|
||||
$this->catchExceptions = $catchExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request.
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
protected function doRequest($request)
|
||||
{
|
||||
$response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $this->catchExceptions);
|
||||
|
||||
if ($this->kernel instanceof TerminableInterface) {
|
||||
$this->kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the script to execute when the request must be insulated.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getScript($request)
|
||||
{
|
||||
$kernel = var_export(serialize($this->kernel), true);
|
||||
$request = var_export(serialize($request), true);
|
||||
|
||||
$errorReporting = error_reporting();
|
||||
|
||||
$requires = '';
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if (0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$file = \dirname(\dirname($r->getFileName())).'/autoload.php';
|
||||
if (file_exists($file)) {
|
||||
$requires .= 'require_once '.var_export($file, true).";\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$requires) {
|
||||
throw new \RuntimeException('Composer autoloader not found.');
|
||||
}
|
||||
|
||||
$code = <<<EOF
|
||||
<?php
|
||||
|
||||
error_reporting($errorReporting);
|
||||
|
||||
$requires
|
||||
|
||||
\$kernel = unserialize($kernel);
|
||||
\$request = unserialize($request);
|
||||
EOF;
|
||||
|
||||
return $code.$this->getHandleScript();
|
||||
}
|
||||
|
||||
protected function getHandleScript()
|
||||
{
|
||||
return <<<'EOF'
|
||||
$response = $kernel->handle($request);
|
||||
|
||||
if ($kernel instanceof Symfony\Component\HttpKernel\TerminableInterface) {
|
||||
$kernel->terminate($request, $response);
|
||||
}
|
||||
|
||||
echo serialize($response);
|
||||
EOF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the BrowserKit request to a HttpKernel request.
|
||||
*
|
||||
* @return Request A Request instance
|
||||
*/
|
||||
protected function filterRequest(DomRequest $request)
|
||||
{
|
||||
$httpRequest = Request::create($request->getUri(), $request->getMethod(), $request->getParameters(), $request->getCookies(), $request->getFiles(), $request->getServer(), $request->getContent());
|
||||
|
||||
foreach ($this->filterFiles($httpRequest->files->all()) as $key => $value) {
|
||||
$httpRequest->files->set($key, $value);
|
||||
}
|
||||
|
||||
return $httpRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters an array of files.
|
||||
*
|
||||
* This method created test instances of UploadedFile so that the move()
|
||||
* method can be called on those instances.
|
||||
*
|
||||
* If the size of a file is greater than the allowed size (from php.ini) then
|
||||
* an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
|
||||
*
|
||||
* @see UploadedFile
|
||||
*
|
||||
* @return array An array with all uploaded files marked as already moved
|
||||
*/
|
||||
protected function filterFiles(array $files)
|
||||
{
|
||||
$filtered = [];
|
||||
foreach ($files as $key => $value) {
|
||||
if (\is_array($value)) {
|
||||
$filtered[$key] = $this->filterFiles($value);
|
||||
} elseif ($value instanceof UploadedFile) {
|
||||
if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
'',
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
UPLOAD_ERR_INI_SIZE,
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$filtered[$key] = new UploadedFile(
|
||||
$value->getPathname(),
|
||||
$value->getClientOriginalName(),
|
||||
$value->getClientMimeType(),
|
||||
$value->getError(),
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the HttpKernel response to a BrowserKit response.
|
||||
*
|
||||
* @return DomResponse A DomResponse instance
|
||||
*/
|
||||
protected function filterResponse($response)
|
||||
{
|
||||
// this is needed to support StreamedResponse
|
||||
ob_start();
|
||||
$response->sendContent();
|
||||
$content = ob_get_clean();
|
||||
|
||||
return new DomResponse($content, $response->getStatusCode(), $response->headers->all());
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,6 @@ use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
* It manages an environment made of application kernel and bundles.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @method string getProjectDir() Gets the project dir (path of the project's composer file) - not defining it is deprecated since Symfony 4.2
|
||||
*/
|
||||
interface KernelInterface extends HttpKernelInterface
|
||||
{
|
||||
@ -130,6 +128,13 @@ interface KernelInterface extends HttpKernelInterface
|
||||
*/
|
||||
public function getRootDir();
|
||||
|
||||
/**
|
||||
* Gets the project dir (path of the project's composer file).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectDir();
|
||||
|
||||
/**
|
||||
* Gets the current container.
|
||||
*
|
||||
|
@ -16,23 +16,15 @@ use Symfony\Component\Ldap\Exception\LdapException;
|
||||
use Symfony\Component\Ldap\Exception\NotBoundException;
|
||||
|
||||
/**
|
||||
* Entry manager interface.
|
||||
*
|
||||
* @author Charles Sarrazin <charles@sarraz.in>
|
||||
* @author Bob van de Vijver <bobvandevijver@hotmail.com>
|
||||
* @author Kevin Schuurmans <kevin.schuurmans@freshheads.com>
|
||||
*
|
||||
* The move() methods must be added to the interface in Symfony 5.0
|
||||
*
|
||||
* @method void move(Entry $entry, string $newParent) Moves an entry on the Ldap server
|
||||
*/
|
||||
interface EntryManagerInterface
|
||||
{
|
||||
/**
|
||||
* Adds a new entry in the Ldap server.
|
||||
*
|
||||
* @param Entry $entry
|
||||
*
|
||||
* @throws NotBoundException
|
||||
* @throws LdapException
|
||||
*/
|
||||
@ -41,27 +33,30 @@ interface EntryManagerInterface
|
||||
/**
|
||||
* Updates an entry from the Ldap server.
|
||||
*
|
||||
* @param Entry $entry
|
||||
*
|
||||
* @throws NotBoundException
|
||||
* @throws LdapException
|
||||
*/
|
||||
public function update(Entry $entry);
|
||||
|
||||
/**
|
||||
* Moves an entry on the Ldap server.
|
||||
*
|
||||
* @throws NotBoundException
|
||||
* @throws LdapException
|
||||
*/
|
||||
public function move(Entry $entry, string $newParent);
|
||||
|
||||
/**
|
||||
* Renames an entry on the Ldap server.
|
||||
*
|
||||
* @param Entry $entry
|
||||
* @param string $newRdn
|
||||
* @param bool $removeOldRdn
|
||||
* @throws NotBoundException
|
||||
* @throws LdapException
|
||||
*/
|
||||
public function rename(Entry $entry, $newRdn, $removeOldRdn = true);
|
||||
public function rename(Entry $entry, string $newRdn, bool $removeOldRdn = true);
|
||||
|
||||
/**
|
||||
* Removes an entry from the Ldap server.
|
||||
*
|
||||
* @param Entry $entry
|
||||
*
|
||||
* @throws NotBoundException
|
||||
* @throws LdapException
|
||||
*/
|
||||
|
@ -1,16 +1,22 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
5.0.0
|
||||
-----
|
||||
|
||||
* Added method `move() to `EntryManagerInterface`
|
||||
* Added pagination support to the ExtLdap adapter with the pageSize query option
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
||||
* added `EntryManager::move`, not implementing it is deprecated
|
||||
* Added `EntryManager::move`, not implementing it is deprecated
|
||||
* Added pagination support to the ExtLdap adapter with the pageSize query option
|
||||
|
||||
4.2.0
|
||||
-----
|
||||
|
||||
* added `EntryManager::applyOperations`
|
||||
* Added `EntryManager::applyOperations`
|
||||
* Added timeout option to `ConnectionOptions`
|
||||
|
||||
4.1.0
|
||||
@ -22,13 +28,13 @@ CHANGELOG
|
||||
4.0.0
|
||||
-----
|
||||
|
||||
* removed the `LdapClient` class and the `LdapClientInterface`
|
||||
* removed the `RenameEntryInterface` interface and merged with `EntryManagerInterface`
|
||||
* Removed the `LdapClient` class and the `LdapClientInterface`
|
||||
* Removed the `RenameEntryInterface` interface and merged with `EntryManagerInterface`
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
* The `RenameEntryInterface` inferface is deprecated, and will be merged with `EntryManagerInterface` in 4.0.
|
||||
* The `RenameEntryInterface` inferface is deprecated, and will be merged with `EntryManagerInterface` in 4.0.
|
||||
|
||||
3.1.0
|
||||
-----
|
||||
|
@ -20,6 +20,10 @@ CHANGELOG
|
||||
the `getReachableRoleNames()` method instead and return roles as strings.
|
||||
* Removed the `getRoles()` method from the `TokenInterface`. Tokens must implement the `getRoleNames()` method
|
||||
instead and return roles as strings.
|
||||
* Made the `serialize` and `unserialize` methods of `AbstractToken` final and internal
|
||||
* Removed the `serialize` and `unserialize` methods from `AuthenticationException`
|
||||
* Added method `__serialize` and `__unserialize` to `TokenInterface`
|
||||
* Added method `needsRehash` to `PasswordEncoderInterface` and `UserPasswordEncoderInterface`
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Security\Core\Authentication;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\AuthenticationEvents;
|
||||
@ -21,6 +19,7 @@ use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
||||
use Symfony\Component\Security\Core\Exception\AccountStatusException;
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
use Symfony\Component\Security\Core\Exception\ProviderNotFoundException;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
/**
|
||||
* AuthenticationProviderManager uses a list of AuthenticationProviderInterface
|
||||
@ -51,12 +50,9 @@ class AuthenticationProviderManager implements AuthenticationManagerInterface
|
||||
$this->eraseCredentials = $eraseCredentials;
|
||||
}
|
||||
|
||||
/**
|
||||
* @final since Symfony 4.3, the type-hint will be updated to the interface from symfony/contracts in 5.0
|
||||
*/
|
||||
public function setEventDispatcher(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
$this->eventDispatcher = $dispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -143,25 +143,6 @@ abstract class AbstractToken implements TokenInterface
|
||||
return [$this->user, $this->authenticated, null, $this->attributes, $this->roleNames];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @final since Symfony 4.3, use __serialize() instead
|
||||
*
|
||||
* @internal since Symfony 4.3, use __serialize() instead
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
$serialized = $this->__serialize();
|
||||
|
||||
if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
|
||||
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
|
||||
}
|
||||
|
||||
return $isCalledFromOverridingMethod ? $serialized : serialize($serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the object state from an array given by __serialize().
|
||||
*
|
||||
@ -183,18 +164,6 @@ abstract class AbstractToken implements TokenInterface
|
||||
[$this->user, $this->authenticated, , $this->attributes, $this->roleNames] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @final since Symfony 4.3, use __unserialize() instead
|
||||
*
|
||||
* @internal since Symfony 4.3, use __unserialize() instead
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$this->__unserialize(\is_array($serialized) ? $serialized : unserialize($serialized));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the token attributes.
|
||||
*
|
||||
@ -272,6 +241,22 @@ abstract class AbstractToken implements TokenInterface
|
||||
return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUsername(), json_encode($this->authenticated), implode(', ', $roles));
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final public function serialize()
|
||||
{
|
||||
return serialize($this->__serialize());
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final public function unserialize($serialized)
|
||||
{
|
||||
$this->__unserialize(\is_array($serialized) ? $serialized : unserialize($serialized));
|
||||
}
|
||||
|
||||
private function hasUserChanged(UserInterface $user)
|
||||
{
|
||||
if (!($this->user instanceof UserInterface)) {
|
||||
|
@ -16,9 +16,6 @@ namespace Symfony\Component\Security\Core\Authentication\Token;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
|
||||
*
|
||||
* @method array __serialize() Returns all the necessary state of the object for serialization purposes - not implementing it is deprecated since Symfony 4.3
|
||||
* @method void __unserialize(array $data) Restores the object state from an array given by __serialize() - not implementing it is deprecated since Symfony 4.3
|
||||
*/
|
||||
interface TokenInterface extends \Serializable
|
||||
{
|
||||
@ -134,4 +131,14 @@ interface TokenInterface extends \Serializable
|
||||
* @param mixed $value The attribute value
|
||||
*/
|
||||
public function setAttribute($name, $value);
|
||||
|
||||
/**
|
||||
* Returns all the necessary state of the object for serialization purposes.
|
||||
*/
|
||||
public function __serialize(): array;
|
||||
|
||||
/**
|
||||
* Restores the object state from an array given by __serialize().
|
||||
*/
|
||||
public function __unserialize(array $data): void;
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Security\Core\Authorization\Voter;
|
||||
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||
use Symfony\Component\Security\Core\Event\VoteEvent;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
@ -31,7 +30,7 @@ class TraceableVoter implements VoterInterface
|
||||
public function __construct(VoterInterface $voter, EventDispatcherInterface $eventDispatcher)
|
||||
{
|
||||
$this->voter = $voter;
|
||||
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
$this->eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
||||
public function vote(TokenInterface $token, $subject, array $attributes)
|
||||
|
@ -17,8 +17,6 @@ use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||
* PasswordEncoderInterface is the interface for all encoders.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @method bool needsRehash(string $encoded)
|
||||
*/
|
||||
interface PasswordEncoderInterface
|
||||
{
|
||||
@ -47,4 +45,9 @@ interface PasswordEncoderInterface
|
||||
* @throws \InvalidArgumentException If the salt is invalid
|
||||
*/
|
||||
public function isPasswordValid($encoded, $raw, $salt);
|
||||
|
||||
/**
|
||||
* Checks if an encoded password would benefit from rehashing.
|
||||
*/
|
||||
public function needsRehash(string $encoded): bool;
|
||||
}
|
||||
|
@ -17,8 +17,6 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
||||
* UserPasswordEncoderInterface is the interface for the password encoder service.
|
||||
*
|
||||
* @author Ariel Ferrandini <arielferrandini@gmail.com>
|
||||
*
|
||||
* @method bool needsRehash(UserInterface $user, string $encoded)
|
||||
*/
|
||||
interface UserPasswordEncoderInterface
|
||||
{
|
||||
@ -39,4 +37,9 @@ interface UserPasswordEncoderInterface
|
||||
* @return bool true if the password is valid, false otherwise
|
||||
*/
|
||||
public function isPasswordValid(UserInterface $user, $raw);
|
||||
|
||||
/**
|
||||
* Checks if an encoded password would benefit from rehashing.
|
||||
*/
|
||||
public function needsRehash(UserInterface $user, string $encoded): bool;
|
||||
}
|
||||
|
@ -58,25 +58,6 @@ class AuthenticationException extends RuntimeException
|
||||
return [$this->token, $this->code, $this->message, $this->file, $this->line];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @final since Symfony 4.3, use __serialize() instead
|
||||
*
|
||||
* @internal since Symfony 4.3, use __serialize() instead
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
$serialized = $this->__serialize();
|
||||
|
||||
if (null === $isCalledFromOverridingMethod = \func_num_args() ? \func_get_arg(0) : null) {
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 2);
|
||||
$isCalledFromOverridingMethod = isset($trace[1]['function'], $trace[1]['object']) && 'serialize' === $trace[1]['function'] && $this === $trace[1]['object'];
|
||||
}
|
||||
|
||||
return $isCalledFromOverridingMethod ? $serialized : serialize($serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the object state from an array given by __serialize().
|
||||
*
|
||||
@ -98,48 +79,6 @@ class AuthenticationException extends RuntimeException
|
||||
[$this->token, $this->code, $this->message, $this->file, $this->line] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @final since Symfony 4.3, use __unserialize() instead
|
||||
*
|
||||
* @internal since Symfony 4.3, use __unserialize() instead
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
$this->__unserialize(\is_array($serialized) ? $serialized : unserialize($serialized));
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) {
|
||||
@trigger_error(sprintf('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3, implement the __serialize() and __unserialize() methods instead.', $c), E_USER_DEPRECATED);
|
||||
$this->serialized = $this->serialize();
|
||||
} else {
|
||||
$this->serialized = $this->__serialize();
|
||||
}
|
||||
|
||||
return ['serialized'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'unserialize'))->getDeclaringClass()->name) {
|
||||
@trigger_error(sprintf('Implementing the "%s::unserialize()" method is deprecated since Symfony 4.3, implement the __serialize() and __unserialize() methods instead.', $c), E_USER_DEPRECATED);
|
||||
$this->unserialize($this->serialized);
|
||||
} else {
|
||||
$this->__unserialize($this->serialized);
|
||||
}
|
||||
|
||||
unset($this->serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Message key to be used by the translation component.
|
||||
*
|
||||
@ -159,4 +98,23 @@ class AuthenticationException extends RuntimeException
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep()
|
||||
{
|
||||
$this->serialized = $this->__serialize();
|
||||
|
||||
return ['serialized'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __wakeup()
|
||||
{
|
||||
$this->__unserialize($this->serialized);
|
||||
unset($this->serialized);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Security\Guard;
|
||||
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
@ -46,7 +45,7 @@ class GuardAuthenticatorHandler
|
||||
public function __construct(TokenStorageInterface $tokenStorage, EventDispatcherInterface $eventDispatcher = null, array $statelessProviderKeys = [])
|
||||
{
|
||||
$this->tokenStorage = $tokenStorage;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
|
||||
$this->dispatcher = $eventDispatcher;
|
||||
$this->statelessProviderKeys = $statelessProviderKeys;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Workflow;
|
||||
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Component\Workflow\Event\AnnounceEvent;
|
||||
use Symfony\Component\Workflow\Event\CompletedEvent;
|
||||
use Symfony\Component\Workflow\Event\EnteredEvent;
|
||||
@ -43,7 +42,7 @@ class Workflow implements WorkflowInterface
|
||||
{
|
||||
$this->definition = $definition;
|
||||
$this->markingStore = $markingStore ?: new MultipleStateMarkingStore();
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user