10000 [HttpKernel] render_esi should behave in dev as it does in prod by bpaulin · Pull Request #15056 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpKernel] render_esi should behave in dev as it does in prod #15056

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 2 commits into from

Conversation

bpaulin
Copy link
@bpaulin bpaulin commented Jun 21, 2015
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR todo
  • gather feedback
  • submit changes to the documentation

Hello,

If an object can't be turned into a string for the URL, then calling render_esi would throw an exception.
But in dev env, render_esi silently falls back on using a InlineFragmentRenderer and everything seems to work.

I add a parameter (framework.fragments.strict) to make the fallback throw the same exception, to detect the logic error in dev mode, before deploying on an env with cache enabled.

@jevillard
Copy link

+1 for this feature @bpaulin

@fabpot
Copy link
Member
fabpot commented Jun 21, 2015

Adding an option only makes things more difficult for no real benefit. Either we think that the current behavior is best, and no need to do anything, or we think the new behavior is much better and it should be the default.

@bpaulin
Copy link
Author
bpaulin commented Jun 21, 2015

I agree and I think the new behaviour would be better.
The option was here to avoid breaking compatibility.

I can rebase this pr and set this as default if needed

Thanks!

@bpaulin
Copy link
Author
bpaulin commented Jun 24, 2015

Hello again,
no more parameter now.
If InlineFragmentRenderer is called as fallback for EsiFragmentRenderer, it now checks the logic error.

@fabpot : I'm not sure if this pr should be on 2.7 now, there is a BC break after all.
everyone : any feedback?

@
8000
bpaulin bpaulin force-pushed the strict-render-fragment branch from 57cac09 to 971e1d6 Compare June 28, 2015 16:25
@bpaulin bpaulin changed the title [WIP][HttpKernel] render_esi should behave in dev as it does in prod [HttpKernel] render_esi should behave in dev as it does in prod Jun 29, 2015
@@ -59,6 +59,11 @@ public function render($uri, Request $request, array $options = array())
// want that as we want to preserve objects (so we manually set Request attributes
// below instead)
$attributes = $reference->attributes;
if (isset($options['is_fallback']) && $options['is_fallback'] )
{
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why fabbot did not catch it, but we put opening braces on the same line as the if

@jakzal
Copy link
Contributor
jakzal commented Sep 28, 2015

If an object can't be turned into a string for the URL, then calling render_esi would throw an exception.
But in dev env, render_esi silently falls back on using a InlineFragmentRenderer and everything seems to work.

I suggest we treat it as a bug and consistently throw and exception in all environments (or at least, fallback to inline renderer consistently). We don't need an option here. There's also no BC break since no one could possibly rely on this inconsistency. If a bug like this slipped through dev, it would be discovered on production, investigated and fixed.

< 8000 div class="js-timeline-item js-timeline-progressive-focus-container" data-gid="MDEyOklzc3VlQ29tbWVudDE0NDUxNTYxNA==">
@xabbuh
Copy link
Member
xabbuh commented Sep 30, 2015

I agree. This should be consistent regardless the environment.

@fabpot
Copy link
Member
fabpot commented Jan 7, 2016

closing in favor of #16283

@fabpot fabpot closed this Jan 7, 2016
fabpot added a commit that referenced this pull request Jan 31, 2016
…es to the ESI and SSI renderers (jakzal)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[HttpKernel] Deprecate passing objects as URI attributes to the ESI and SSI renderers

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

Commits
-------

a38d96e [HttpKernel] Deprecate passing objects as URI attributes to the ESI and SSI renderers
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
0