csrf错误FOSUserBundle

时间:2018-02-21 11:44:45

标签: php symfony fosuserbundle

即时通讯使用symfony 3.4.4我尝试按照FOSUser文档安装fosuserbundle:https://symfony.com/doc/master/bundles/FOSUserBundle/index.html

当我执行命令时:

class MultilineFunctionCallSniff extends BaseSniff {
    public function __construct() {
        $violations = array();

        $register = \PHP_CodeSniffer_Tokens::$functionNameTokens;

        parent::__construct(
            $register,
            $violations,
            "MultilineFunctionCall"
        );
    }   
}

我收到了这个错误:

bin/console doctrine:schema:update --force

有没有解决方案?

配置yml

The service "security.authentication.listener.form.main" has a dependency on a non-existent service "security.csrf.token_manager"

security yml

安全性:     编码器:         FOS \ UserBundle \ Model \ UserInterface:bcrypt

framework:
    csrf_protection: ~
    #esi: ~
    translator: { fallbacks: ['%locale%'] }
    secret: '%secret%'
    router:
        resource: '%kernel.project_dir%/app/config/routing.yml'
        strict_requirements: ~
    form: { enabled: false }
    csrf_protection: { enabled: false }
    validation: { enable_annotations: true }
    serializer: { enable_annotations: true }
    templating:
        engines: ['twig']
    default_locale: '%locale%'
    trusted_hosts: ~
    session:
        # http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
        handler_id: session.handler.native_file
        save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
    fragments: { enabled: false }
    http_method_override: true
    assets: ~
    php_errors:
        log: true

1 个答案:

答案 0 :(得分:1)

framework:
    csrf_protection: ~

该页面上的文档已过时。这个问题很快就会在symfony/symfony #25808

中解决

有关此错误的更多信息:https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2705