自Symfony 4.1起,如何修复“ ContextListener :: setLogoutOnUserChange()”方法已弃用?

时间:2019-09-21 17:35:01

标签: symfony symfony-3.4 symfony-security

我正在使用symfony 3.4

这是我的App security.yaml

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        FOS\UserBundle\Model\UserInterface: sha512

    role_hierarchy:
        ROLE_ADMIN:       [ROLE_USER]
        ROLE_SUPER_ADMIN: [ROLE_ADMIN]

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        main:
          pattern: ^/
          form_login:
              provider: fos_userbundle
              csrf_token_generator: security.csrf.token_manager 

          logout_on_user_change: true
          ...

经过phpunit测试后,我得到了:

  

剩余的直接弃用通知(xx)

     

从Symfony 4.1开始不推荐使用“ Symfony \ Component \ Security \ Http \ Firewall \ ContextListener :: setLogoutOnUserChange()”方法。

我会修复它,但是如果我从security.yml中删除

  

logout_on_user_change:是​​

我知道了

  

从3.4版开始,不赞成在防火墙“ main”上将“ logout_on_user_change”设置为true,在4.0版本中始终如此。

composer.json

    "require": {
        "php": ">=7.2",
        "fi/osbundle": "~2.0",
        "friendsofsymfony/jsrouting-bundle": "^2.2",
        "friendsofsymfony/user-bundle": "^2.1",
        "mysql-workbench-schema-exporter/doctrine2-exporter": "^3.0",
        "mysql-workbench-schema-exporter/mysql-workbench-schema-exporter": "^3.0",
        "phpoffice/phpspreadsheet": "^1.4",
        "sensio/distribution-bundle": "^5.0",
        "symfony/asset": "^3.4",
        "symfony/console": "^3.4",
        "symfony/dotenv": "^3.4",
        "symfony/flex": "^1.0",
        "symfony/form": "^3.4",
        "symfony/lock": "^3.4",
        "symfony/maker-bundle": "^1.7",
        "symfony/monolog-bundle": "^3.2",
        "symfony/orm-pack": "^1.0",
        "symfony/security-bundle": "^3.4",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/translation": "^3.4",
        "symfony/twig-bundle": "^3.4",
        "symfony/validator": "^3.4",
        "symfony/webpack-encore-bundle": "^1.5",
        "symfony/yaml": "^3.4"
    },
    "require-dev": {
        "php-coveralls/php-coveralls": "^2.0",
        "phpmd/phpmd": "^2.6",
        "sebastian/phpcpd": "^3.0",
        "sensiolabs/security-checker": "^5.0",
        "squizlabs/php_codesniffer": "^3.3",
        "symfony/framework-bundle": "^3.4",
        "symfony/panther": "^0.4.1",
        "symfony/profiler-pack": "^1.0",
        "symfony/test-pack": "^1.0",
        "symfony/var-dumper": "^3.4",
        "symfony/web-server-bundle": "^3.4"
    },
    "conflict": {
        "symfony/symfony": "*"
    }

enter image description here

enter image description here

有什么建议吗?

0 个答案:

没有答案