Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpKernel] Make the behaviour of surrogate renderers consistent in all environments #16283

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

jakzal
Copy link
Contributor

@jakzal jakzal commented Oct 19, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #15056
License MIT
Doc PR -

Surrogate renderers cannot work with objects (rule introduced in #8437). As renderers should be interchangable, we should not allow passing objects to the fallback renderer either.

@@ -64,6 +64,10 @@ public function __construct(SurrogateInterface $surrogate = null, FragmentRender
public function render($uri, Request $request, array $options = array())
{
if (!$this->surrogate || !$this->surrogate->hasSurrogateCapability($request)) {
if ($uri instanceof ControllerReference) {
$this->checkNonScalar($uri->attributes);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of making checkNonScalar() protected in order to call it here, we could generate the uri instead:

if ($uri instanceof ControllerReference) {
    $uri = $this->generateFragmentUri($uri, $request, false, true);
}

return $this->inlineStrategy->render($uri, $request, $options);

This way, however, _locale and _format might not be passed properly as the following code in the InlineFragmentRenderer wouldn't be called:

foreach (array('_format', '_locale') as $key) {
    if (isset($attributes[$key])) {
        $reference->attributes[$key] = $attributes[$key];
    }
}

I'm not sure if this is an issue. Perhaps it'd actually be good, if we're trying to make the dev/non-dev behaviour consistent for surrogate renderers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

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

I prefer your current solution. This looks good to me.

… all environments

Surrogate renderers cannot work with objects. As renderers should be interchangable, we should not allow passing objects to the fallback renderer either.
@jakzal jakzal force-pushed the render-esi-fallback-consistency branch from 8522159 to 0b489aa Compare October 21, 2015 06:38
@stof
Copy link
Member

stof commented Oct 21, 2015

Isn't this a BC break ?

@jakzal
Copy link
Contributor Author

jakzal commented Oct 21, 2015

@stof if anyone relied on this behaviour he'd run into issues after deploying his app to production. Passing objects as uri attributes might have worked on dev with the inline renderer, but it would fail in prod with a real reverse proxy present.

@jakzal jakzal added the Ready label Oct 29, 2015
@jakzal
Copy link
Contributor Author

jakzal commented Dec 30, 2015

ping @symfony/deciders

@xabbuh
Copy link
Member

xabbuh commented Jan 2, 2016

👍

@fabpot
Copy link
Member

fabpot commented Jan 7, 2016

I would still consider this as a BC break. What people only using the inline renderer?

@fabpot
Copy link
Member

fabpot commented Jan 25, 2016

@jakzal Can you work on submitting a PR on master for this change and generate the proper deprecation notices?

@xabbuh
Copy link
Member

xabbuh commented Jan 25, 2016

@fabpot But who would run their application only in the dev environment (as the application would break in prod they would probably never deploy it, would they?)?

@jakzal
Copy link
Contributor Author

jakzal commented Jan 25, 2016

@fabpot this change only affects surrogate renderers. The inline renderer is only used as a fallback here.

@jakzal
Copy link
Contributor Author

jakzal commented Jan 25, 2016

Sorry. I only just got what you were saying. Indeed, people might have relied on this behaviour in prod if they chose not to use a real reverse proxy.

I'll work on deprecation messages.

@jakzal
Copy link
Contributor Author

jakzal commented Jan 30, 2016

Deprecated in #17611

@fabpot
Copy link
Member

fabpot commented Jan 31, 2016

Closing in favor of #17611

@fabpot fabpot closed this Jan 31, 2016
@jakzal jakzal deleted the render-esi-fallback-consistency branch January 31, 2016 19:31
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.

5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.