Skip to content

[HttpKernel] Dont implement ServiceSubscriberInterface on *SessionListener #22207

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

Merged
merged 1 commit into from
Mar 31, 2017

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Mar 28, 2017

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #22171, silexphp/Silex#1496
License MIT
Doc PR -

Implementing ServiceSubscriberInterface creates a dep on the DI component, which Silex can't afford. Let's revert that part.

@GromNaN can you please confirm this fixes your issue?

@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Mar 28, 2017
@nicolas-grekas nicolas-grekas changed the title [HttpKernel] Dont implement ServiceSubscriberInterface on *SessionLis… [HttpKernel] Dont implement ServiceSubscriberInterface on *SessionListener Mar 28, 2017
Copy link
Member

@chalasr chalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@fabpot
Copy link
Member

fabpot commented Mar 29, 2017

I would add a note somewhere in the code or in the XML service definition to avoid breaking this again in the future. Can we also check that we don't have any other similar issues?

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Mar 29, 2017 via email

<argument type="service" id="container" />
<argument type="service">
<service class="Symfony\Component\DependencyInjection\ServiceLocator">
<tag name="container.service_locator" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, tagging anonymous services inside an argument does not work, as this Definition is not registered directly in the container (well, I think the XMLFileLoader converts inlined definition to normal private services with a random id, which is why it works here, but creating an inlined definition in PHP would not work as it would stay inline). Should we keep it like this ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's an issue when using findTaggedServiceIds, but ServiceLocatorTagPass visits recursively all definitions by using AbstractRecursivePass, so it works :)

@GromNaN
Copy link
Member

GromNaN commented Mar 29, 2017

Removing the ServiceSubscriberInterface solves the issue of having a hard dependency to the DI component. But ...

@chalasr
Copy link
Member

chalasr commented Mar 29, 2017

@GromNaN These classes are abstract and missed theAbstract prefix. There is no gain in adding it apart from making them consistent with others by convention. The thing is that we moved concrete implementations from the framework to the component. These classes being named the same as their abstract parent, we grabbed the opportunity for renaming which is fine I think.

What is the purpose of the abstract classes if overloading method can be done in subclass

The added implementations are useful on their own. A day Silex could use a PSR-11 container and remove their concrete implementations in favor of them.

About the change reverted here, these classes can live without. New features are used in the core as possible, but it's not worth breaking consumers code nor forcing them to require a new component.

Copy link
Member

@stof stof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@stof
Copy link
Member

stof commented Mar 30, 2017

Status: reviewed

@fabpot
Copy link
Member

fabpot commented Mar 31, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 7cd90f5 into symfony:master Mar 31, 2017
fabpot added a commit that referenced this pull request Mar 31, 2017
…*SessionListener (nicolas-grekas)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[HttpKernel] Dont implement ServiceSubscriberInterface on *SessionListener

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22171, silexphp/Silex#1496
| License       | MIT
| Doc PR        | -

Implementing `ServiceSubscriberInterface` creates a dep on the DI component, which Silex can't afford. Let's revert that part.

@GromNaN can you please confirm this fixes your issue?

Commits
-------

7cd90f5 [HttpKernel] Dont implement ServiceSubscriberInterface on *SessionListener
@nicolas-grekas nicolas-grekas deleted the di-sersub branch April 3, 2017 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants