merged branch fabpot/fragment-fix (PR #6996)

This PR was merged into the 2.2 branch.

Commits
-------

5a2caa5 [HttpKernel] fixed the hinclude fragment renderer when the template is empty

Discussion
----------

[HttpKernel] fixed the hinclude fragment renderer when the template is empty

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

---------------------------------------------------------------------------

by lsmith77 at 2013-02-07T13:36:58Z

does it make sense to allow the template to be empty? i mean isnt this instead an error condition?

---------------------------------------------------------------------------

by fabpot at 2013-02-07T16:16:04Z

Why not? An empty template means and empty content, which you might want as this is just the fallback content displayed when the real content is not loaded yet.
This commit is contained in:
Fabien Potencier 2013-02-07 17:32:34 +01:00
commit f8cf1eb1a2

View File

@ -65,7 +65,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
}
$template = isset($options['default']) ? $options['default'] : $this->globalDefaultTemplate;
if (null !== $this->templating && $this->templateExists($template)) {
if (null !== $this->templating && $template && $this->templateExists($template)) {
$content = $this->templating->render($template);
} else {
$content = $template;