Skip to content

Commit

Permalink
Merge pull request sonata-project#2959 from Soullivaneuh/deprecated-c…
Browse files Browse the repository at this point in the history
…srf-token

Fix deprecated CsrfTokenManagerAdapter::generateCsrfToken method usage
  • Loading branch information
rande committed May 5, 2015
2 parents 38d234e + 4e56d32 commit e9e161d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1285,11 +1285,16 @@ protected function escapeHtml($s)
*/
protected function getCsrfToken($intention)
{
if (!$this->container->has('form.csrf_provider')) {
return false;
if ($this->container->has('security.csrf.token_manager')) {
return $this->container->get('security.csrf.token_manager')->getToken($intention)->getValue();
}

// TODO: Remove it when bumping requirements to SF 2.4+
if ($this->container->has('form.csrf_provider')) {
return $this->container->get('form.csrf_provider')->generateCsrfToken($intention);
}

return $this->container->get('form.csrf_provider')->generateCsrfToken($intention);
return false;
}

/**
Expand Down

0 comments on commit e9e161d

Please sign in to comment.