2015-04-12 32 views
0

我想重定向用戶在授權成功後更改密碼錶單並且出現此錯誤: OutOfBoundsException:索引「1」不是在[0,0]的範圍內。Symfony 2 OutOfBoundsException:索引「1」不在範圍[0,0]

namespace Infogold\KonsultantBundle\Service; 

    use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; 
    use Symfony\Component\HttpFoundation\Request; 
    use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface; 
    use Symfony\Component\HttpFoundation\RedirectResponse; 
    use Symfony\Component\Routing\RouterInterface; 

    /** 
    * Custom authentication success handler 
    */ 
    class AuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface 
    { 

     protected $router; 

     /** 
     * Constructor 
     * @param RouterInterface $router 
     */ 
     public function __construct(RouterInterface $router) 
     { 
      $this->router = $router; 

     } 

function onAuthenticationSuccess(Request $request, TokenInterface $token) 
    { 
. 
. 
. 

我的服務

parameters: 
    security.authentication.success_handler.class: Infogold\KonsultantBundle\Service\AuthenticationSuccessHandler 

services: 
    security.authentication.success_handler: 
     class: %security.authentication.success_handler.class%  
     arguments: ['@router'] 

,並與兩個防火牆安全,首先是我的防火牆二是從FOSuserBundle:

firewalls: 
       konsultant_area: 
       pattern: ^/konsultant 
       context: my_context1 
       anonymous: true 
       form_login: 
        provider:      administrators  
        use_forward:     true 
        login_path:      /konsultant/login 
        check_path:      /konsultant/login_check    
        post_only:      true 
        always_use_default_target_path: true 
        default_target_path:   /konsultant/klient/indywidualni    
        use_referer:     false 
        success_handler:    security.authentication.success_handler 

        failure_path:     /konsultant/login 
        failure_forward:    false 

        username_parameter:    _username 
        password_parameter:    _password 

       logout: true 

       main: 
       pattern: ^/ 
       context: my_context2 
       . 
       . 
       . 

回答

0

我解決我的probblem。對於誰出現此錯誤sombody: 我更換了下劃線點在

success_handler:    security.authentication.success_handler 
success_handler:    security_authentication_success_handler 

和服務:

parameters: 
    security_authentication_success_handler.class: Infogold\KonsultantBundle\Service\AuthenticationSuccessHandler 

services: 
    security_authentication_success_handler: 
     class: %security_authentication_success_handler.class% 
     public: false 
     arguments: ['@router'] 

現在是一切好起來。

相關問題