Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[console] debug:container SessionHandlerInterface #37245

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
ybenhssaien opened this issue Jun 12, 2020 · 1 comment
Closed

[console] debug:container SessionHandlerInterface #37245

ybenhssaien opened this issue Jun 12, 2020 · 1 comment

Comments

@ybenhssaien
Copy link
Contributor

Symfony version(s) affected: 4.4.9

Description

  • Looking for session.handler by running bin/console debug:container session.handler-v we get the result
    image

  • But running a bin/console debug:container SessionHandlerInterface -v we get [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] You have requested a non-existent service "session.handler".
    image

How to reproduce

  • Without any Service implements SessionHandlerInterface (the case for a fresh symfony installation from skeleton)
  • Run the console command : bin/console debug:container SessionHandlerInterface -v

Possible Solution

Additional context

@nicolas-grekas
Copy link
Member

@youssefbenhssaien would you like to have a closer look and submit a PR?

ybenhssaien pushed a commit to ybenhssaien/symfony that referenced this issue Jul 14, 2020
ybenhssaien pushed a commit to ybenhssaien/symfony that referenced this issue Jul 14, 2020
ybenhssaien pushed a commit to ybenhssaien/symfony that referenced this issue Jul 14, 2020
@fabpot fabpot closed this as completed Jul 23, 2020
fabpot added a commit that referenced this issue Jul 23, 2020
…dler_id is not provided (Youssef BENHSSAIEN)

This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] set default session.handler alias if handler_id is not provided

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37245
| License       | MIT
| Doc PR        |

Without a configured [`handler_id`](https://symfony.com/doc/current/session.html#configuration), the `session.handler` alias is not created, and somes services depend on this alias specialy.

Related to the reported issue above (affected version 4.4.9), the `ServiceHandlerInterface` is an alias of `session.handler`, when execute :
- `bin/console debug:container session.handler` : The alias is not defined, so the `ContainerDebugCommand` look for a service containing the `session.handler` as part of his name (ContainerDebugCommand::findServiceIdsContaining() is called and returns by default `session.handler.native_file`)
-  `bin/console debug:container SessionHandlerInterface` : The service is defined as an alias of `session.handler`, when calling `ContainerBuilder::getDefinition('session.handler')` the exception occured as the alias is not defined.

# Implemented solution
Create a default `session.handler` when the param `handler_id` is not provided (I choosed `session.handler.native_file` rather than `NullSessionHandler`).

# Affected versions
From [`3.4`](https://github.com/symfony/framework-bundle/blob/3.4/DependencyInjection/FrameworkExtension.php#L879) to [`5.1`](https://github.com/symfony/framework-bundle/blob/5.1/DependencyInjection/FrameworkExtension.php#L955)

Commits
-------

46c8c37 [FrameworkBundle] set default session.handler alias if handler_id is not provided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants