symfony2admingenerator / AdmingeneratorGeneratorBundle

(old-legacy) Admingenerator for Symfony2, parse generator.yml files to build classes
http://symfony2admingenerator.org/
MIT License
360 stars 125 forks source link

ListController::isCsrfTokenValid() changed and need 2 arguments #832

Closed ndoulgeridis closed 9 years ago

ndoulgeridis commented 9 years ago

Hello,

I just tried Symfony 2.6.6 After I updated I got this strict standards error.

Strict standards: Declaration of ....\ListController::isCsrfTokenValid() should be compatible with Symfony\Bundle\FrameworkBundle\Controller\Controller::isCsrfTokenValid($id, $token) in .....BaseFooController\ListController.php on line 19

I think this should be fixed in vendor/cedriclombardot/admingenerator-generator-bundle/Admingenerator/GeneratorBundle/Resources/templates/CommonAdmin/csrf_protection.php.twig

{% block csrf_check_token %}

/**
 * Check crsf token provided for action
 *
 * @throw InvalidCsrfTokenException if token is invalid
 */
protected function isCsrfTokenValid($intention)
{
    $token = $this->getRequest()->request->get('_csrf_token');
    if (!$this->get('form.csrf_provider')->isCsrfTokenValid($intention, $token)) {
        throw new InvalidCsrfTokenException();
    }
}

 {% endblock %}

I also found many occurrences using

$this->isCsrfTokenValid($intention);

but now this method should have 2 arguments instead

ioleo commented 9 years ago

Closeing, duplicate of #789. Please see that issue for more info.