bug #9423 [Form] fix CsrfProviderAdapter (Tobion)
This PR was merged into the master branch.
Discussion
----------
[Form] fix CsrfProviderAdapter
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Fixes | #9418
| Tests pass? | yes
| license? | MIT
Commits
-------
887f71c
[Form] fix CsrfProviderAdapter
This commit is contained in:
commit
7455650904
@ -46,7 +46,7 @@ class CsrfProviderAdapter implements CsrfTokenManagerInterface
|
||||
*/
|
||||
public function getToken($tokenId)
|
||||
{
|
||||
return $this->csrfProvider->generateCsrfToken($tokenId);
|
||||
return new CsrfToken($tokenId, $this->csrfProvider->generateCsrfToken($tokenId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,12 +52,20 @@ class FormRenderer implements FormRendererInterface
|
||||
*/
|
||||
private $variableStack = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param FormRendererEngineInterface $engine
|
||||
* @param CsrfTokenManagerInterface|null $csrfTokenManager
|
||||
*
|
||||
* @throws UnexpectedTypeException
|
||||
*/
|
||||
public function __construct(FormRendererEngineInterface $engine, $csrfTokenManager = null)
|
||||
{
|
||||
if ($csrfTokenManager instanceof CsrfProviderInterface) {
|
||||
$csrfTokenManager = new CsrfProviderAdapter($csrfTokenManager);
|
||||
} elseif (null !== $csrfTokenManager && !$csrfTokenManager instanceof CsrfTokenManagerInterface) {
|
||||
throw new UnexpectedTypeException($csrfTokenManager, 'CsrfProviderInterface or CsrfTokenManagerInterface');
|
||||
throw new UnexpectedTypeException($csrfTokenManager, 'CsrfProviderInterface or CsrfTokenManagerInterface or null');
|
||||
}
|
||||
|
||||
$this->engine = $engine;
|
||||
|
Reference in New Issue
Block a user