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

Skip to content

[HttpKernel] Revert BC break introduced by #8957 #11040

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
wants to merge 1 commit into from

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Jun 2, 2014

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

464439d (#8957) creates a BC break. At least the SonataPage CMS used with the "host and path" strategy (http://sonata-project.org/bundles/page/master/doc/reference/multisite.html#host-and-path-strategy) is not working anymore because of this patch.

SonataPage extends the Request class without using the new factory system (there is probably a cleaner way to implement the "host and path" strategy in the CMS too).

When a subrequest is handled by InlineFragment, a request of type Symfony\Component\HttpFoundation\Request is instantiated instead of the expected Sonata\PageBundle\Request\SiteRequest. Then, SonataPage fail processing the subrequest.

I've just reverted the part of this commit changing the previous behavior, the factory system is still working.

ping @fabpot @rande @Sinjonathan

@stof
Copy link
Member

stof commented Jun 3, 2014

the Sonata bundle should be updated to use the supported extension point instead IMO

@dunglas
Copy link
Member Author

dunglas commented Jun 3, 2014

@stof I agree, the SonataBundle must be fixed. But this BC break should be fixed too.
We have some legacy code that use this old way. We will upgrade to the factory system but we are probably not alone. For lightweight needs (such as in the Sonata Bundle), extending the request this way is practical (no factory to implement).

This patch is tiny and using a static method on an instance instead of a class is not a problem (this is documented as allowed: http://php.net/manual/en/language.oop5.static.php).

@stof
Copy link
Member

stof commented Jun 3, 2014

btw, if the Sonata bundle is broken since more than 6 months (this change was released with 2.4.0 6 months ago) without anyone noticing it, the question is whether the feature is used much.

@dunglas
Copy link
Member Author

dunglas commented Jun 3, 2014

We were using it on some projects with a 2.3 (LTS, not affected by this bug) and are considering an upgrade to 2.5. It's how we found this problem.
Multisite is a common feature for a CMS but maybe that SonataPage is not widely used, @rande do you have some insight about that?

@cordoval
Copy link
Contributor

cordoval commented Jun 3, 2014

@stof is right, if it was released with 2.4.0 that means added functionality so this is valid. We should however include the fix on 2.4.* so that this gets supported as a bugfix and makes it BC with this use case.

@fabpot
Copy link
Member

fabpot commented Jun 6, 2014

Extending the Request class is a very bad practice. Supporting it is an edge case and I added support for it quite reluctantly. This kind of PRs/issues make me think that it was indeed a bad idea to support that. So, as nobody had this problem during the last 6 months, it confirms that this is indeed an edge case; so closing this as the change occurred in a new version (not in a bug fix one).

@fabpot fabpot closed this Jun 6, 2014
@cordoval
Copy link
Contributor

cordoval commented Jun 6, 2014

Oh this made me think of a tool I have been thinking about writing to analyze BC. I just started it tonight https://github.com/cordoval/bc-analyzer

@dunglas dunglas deleted the revert_request_bc branch December 5, 2015 09:00
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

Successfully merging this pull request may close these issues.

4 participants