【问题标题】:Symfony, upgrading from v3.3 to v3.4 errorSymfony,从 v3.3 升级到 v3.4 错误
【发布时间】:2018-04-08 23:34:34
【问题描述】:

我将 composer.json 中的 Symfony 版本从 3.3 更改为 3.4,然后运行更新命令。

使用命令“composer update”升级到 v3.4 后,显示此错误:

Ahmads-MacBook-Pro-2:Courses ahmadwa$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 2 updates, 0 removals
  - Updating symfony/symfony (v3.3.16 => v3.4.7): Loading from cache
  - Updating whiteoctober/breadcrumbs-bundle (1.4.0 => 1.4.1): Loading from cache
Writing lock file
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

在 Definition.php 第 263 行:

  Service "security.authentication.provider.simple_form.secured_area": The in  
  dex "3" is not in the range [0, 2].                                          


Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception


  [RuntimeException]                                                               
  An error occurred when executing the "'cache:clear --no-warmup'" command:        

在Definition.php第263行:

    Service "security.authentication.provider.simple_form.secured_area": The in    
    dex "3" is not in the range [0, 2].                                            


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

我的 security.yml 内容是:

security:
  encoders:
    AppBundle\Entity\User:
      algorithm: bcrypt
      cost: 12
  role_hierarchy:
    ROLE_ADMIN: [ROLE_USER]
  providers:
    user_db:
      entity: { class: "AppBundle:User" }
  firewalls:
    dev:
      pattern: "^/(_(profiler|wdt)|css|images|js)/"
      security: false
    secured_area:
      anonymous: ~
      pattern: "^/"
      simple_form:
        authenticator: courses_authenticator
        check_path: login_check
        login_path: login
      form_login:
        login_path: "/login"
        check_path: "/login_check"
        default_target_path: "/"
        username_parameter: "_username"
        password_parameter: "_password"
        use_referer: true
        success_handler: authentication_handler
        failure_handler: authentication_handler
      logout:
        path: "/logout"
        target: "/login"
        success_handler: authentication_handler
  access_denied_url: "/login"
  access_control:
    - { path: ^/admin, roles: ROLE_ADMIN }
    - { path: ^/university, roles: ROLE_UNIVERSITY }
    - { path: ^/developer, roles: [ROLE_DEVELOPER, ROLE_DESIGNER]}
    - { path: ^/designer, roles: ROLE_DESIGNER }
    - { path: ^/dean, roles: ROLE_DEAN }
    - { path: ^/head, roles: ROLE_HEAD }
    - { path: ^/changepassword, roles: [ROLE_ADMIN, ROLE_UNIVERSITY, ROLE_DEVELOPER, ROLE_DESIGNER, ROLE_DEAN, ROLE_HEAD] }
    - { path: ^/editprofile, roles: [ROLE_ADMIN, ROLE_UNIVERSITY, ROLE_DEVELOPER, ROLE_DESIGNER, ROLE_DEAN, ROLE_HEAD] }
    - { path: ^/welcomeMessageAgreement, roles: [ROLE_ADMIN, ROLE_UNIVERSITY] }

我的 PHP 版本是 5.6.30

我搜索了网络和 Symfony 文档,但没有找到与此问题相关的内容。

【问题讨论】:

    标签: symfony


    【解决方案1】:

    我通过将“provider:user_db”添加到“simple_form”来解决这个问题。 也许这对某人有帮助。

    simple_form:
        provider: user_db
        authenticator: courses_authenticator
        check_path: login_check
        login_path: login
    

    【讨论】:

      猜你喜欢
      • 2022-01-10
      • 2022-12-15
      • 1970-01-01
      • 2020-03-22
      • 1970-01-01
      • 1970-01-01
      • 2017-11-04
      • 2017-03-22
      • 1970-01-01
      相关资源
      最近更新 更多