php - Symfony 3.4 - Dependency Injection for ResettingController of FosUserBundle work only in dev env

My initial problem is this error:

Too few arguments to function FOS\UserBundle\Controller\ResettingController::__construct(), 0 passed in /var/www/project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php on line 200 and exactly 6 expected

that happens when i open the link in the automatic Mail of FosUserBundle FOSMailer::sendResettingEmailMessage

// routing.yml
app:
    resource: "@AppBundle/Controller"
    type:     annotation
    prefix:
      /{_locale}/
    requirements:
      _locale: fr|en|es

app_api:
    resource: "@AppBundle/Controller/Api"
    type:     annotation

fos_js_routing:
    resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"

fos_user_security_login:
    path: /connexion
    methods:  [ GET, POST ]
    defaults:  { _controller: FOSUserBundle:Security:login }

fos_user_security_check:
    path: /login_check
    methods:  [ POST ]
    defaults:  { _controller: FOSUserBundle:Security:check }

fos_user_security_logout:
    path: /logout
    methods:  [ GET, POST ]
    defaults:  { _controller: FOSUserBundle:Security:logout }

fos_user_resetting_reset:
    path: /resetting/reset/{token}
    methods: ['GET', 'POST']
    defaults: { _controller: FOSUserBundle:Resetting:reset }

I cleared the cache, and i added the 6 parameters with dependency injection:

//services.yml

services:
  fos_user.resetting.reset:
    class: FOS\UserBundle\Controller\ResettingController
    arguments:
      - "@event_dispatcher"
      - "@fos_user.resetting.form.factory"
      - "@fos_user.user_manager"
      - "@fos_user.util.token_generator"
      - "@fos_user.mailer"
      - "%fos_user.resetting.retry_ttl%"

That worked well in dev environnement (in local and on a server), but i still got the same error "too few arguments..." in production.

So cleared the cache again : bin/console c:c --env=prod

removed the cache folder: rm -Rf var/cache/prod

But i still got the error :/ Does anyone have an idea ?

Answer

Solution:

Thank you @Cerad for your help. I finally found the solution to my problem :

i just realized that the version of fosUserBundle wasn't the same on the 2 servers ...

so i just changed my composer.json with that:

"friendsofsymfony/user-bundle": "2.0.*"

And this works fine!

Source