Skip to content

Issue with the "session" service #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
javiereguiluz opened this issue Jul 15, 2017 · 7 comments
Closed

Issue with the "session" service #130

javiereguiluz opened this issue Jul 15, 2017 · 7 comments

Comments

@javiereguiluz
Copy link
Member

When upgrading a Symfony app to 3.3.4 + Flex and using HWIOAuthBundle, I saw this error message:

!!  Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
!! The service "hwi_oauth.resource_owner.twitter" has a dependency on a non-existent
!! service "session". in
!! <my-project>/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:31
!!
!!  Stack trace:
!!  #0 <my-project>/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(57): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue(Object(Symfony\Component\DependencyInjection\Reference), false)
!!  #1 <my-project>/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php(35): Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue(Array, false)
!!  #2 <my-project>/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php(64): Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInval in <my-project>/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php on line 31
!!

The error message is correct, because the session service doesn't exist:

$ ./bin/console debug:container session

 Select one of the following services to display its information:
  [0] argument_resolver.session
  [1] security.authentication.session_strategy
  [2] security.logout.handler.session

The HttpFoundation 3.3.4 component is installed in the app, but the session service doesn't exist.


For comparison, the Symfony Demo app, which uses the exact same 3.3.4 version, but doesn't use Flex, has the session service defined:

$ ./bin/console debug:container session

Information for Service "session"
=================================

 ---------------- --------------------------------------------------
  Option           Value
 ---------------- --------------------------------------------------
  Service ID       session
  Class            Symfony\Component\HttpFoundation\Session\Session
  Tags             -
  Public           yes
  Synthetic        no
  Lazy             no
  Shared           yes
  Abstract         no
  Autowired        no
  Autoconfigured   no
 ---------------- --------------------------------------------------
@Pierstoval
Copy link
Contributor

Doesn't the framework.session extension configuration has to be specified at least with null to be enabled?

@xabbuh
Copy link
Member

xabbuh commented Jul 17, 2017

Yes, by default it is disabled (the Standard Edition enables is explicitly: https://github.com/symfony/symfony-standard/blob/3.3/app/config/config.yml#L26-L29).

@xabbuh
Copy link
Member

xabbuh commented Jul 17, 2017

and the same is true for the Symfony Demo: https://github.com/symfony/symfony-demo/blob/master/app/config/config.yml#L45-L47

@javiereguiluz
Copy link
Member Author

Thanks for the info. I'm closing this as "no need to fix it". But in symfony/symfony-docs#7809 I've added a note explaining that in 4.0, some important things (such as session) don't exist by default, so we must take care of that in the docs. Thanks!

@fabpot
Copy link
Member

fabpot commented Jul 17, 2017

If HWIOAuthBundle needs a session, then we should have a recipe that enables sessions automatically (the same goes for other important bundles that need a session).

@enlego
Copy link

enlego commented Jul 29, 2017

The same happens while installing FOSUser in Symfony Flex (it requires an inexistent session service)

@slootjes
Copy link
Contributor

slootjes commented Dec 20, 2017

@fabpot What would be the correct method to create a recipe which enables sessions? I could create a meta package for it which adds a config file to set the framework.session option but I guess this could easily conflict if it was already set up.

edit: I see it's discussed here too #247 so let's keep it in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants