You need to launch this Symfony2 version fixer.
Then you have to change every occurrency of security.context
with security.token_storage
(see also this SO answer http://stackoverflow.com/a/29672308/1977778). You must update your codebase to match the security component improvements of version 2.6, as described here.
// Symfony 2.5
$user = $this->get('security.context')->getToken()->getUser();
// Symfony 2.6
$user = $this->get('security.token_storage')->getToken()->getUser();
// Symfony 2.5
if (false === $this->get('security.context')->isGranted('ROLE_ADMIN')) { ... }
// Symfony 2.6
if (false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) { ... }
To update to v3 you need to put Symfony 3+ as a dependency on composer.json. At the time this document was written is "symfony/symfony": "3.2.*"
and, if you're using JMS/TranslationBundle you also need to avoid updating Twig to v2. So, you need to put only a 1+ compatibility with "twig/twig": "~1.31"
.
Add the following methods to AppKernel.php, if they are not here yet.
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
}
public function getLogDir()
{
return dirname(__DIR__).'/var/logs';
}
You can replace
<form method="post" {{ form_enctype(decryptionForm) }}>
by
{{ form_start(decryptionForm) }}
and
</form>
by
{{ form_end(decryptionForm) }}
Change the choice_label attribute on form type with the following callable action.
'choice_label' => function ($value, $key, $index)
https://codereviewvideos.com/blog/fix-csrf-token-is-invalid/