Skip to content
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

Handle null in the html.html.twig template #5906

Merged
merged 1 commit into from Mar 27, 2023
Merged

Conversation

fritzmg
Copy link
Contributor

@fritzmg fritzmg commented Mar 23, 2023

tl_content.html is nullable and thus the following error can occur:

TypeError:
Contao\CoreBundle\Twig\Runtime\InsertTagRuntime::replaceInsertTags(): Argument #1 ($text) must be of type string, null given, called in var\cache\dev\twig\d3\d3515c7374c86e1675c9bdc71501583c.php on line 95

  at vendor\contao\contao\core-bundle\src\Twig\Runtime\InsertTagRuntime.php:33
  at Contao\CoreBundle\Twig\Runtime\InsertTagRuntime->replaceInsertTags(null)
     (var\cache\dev\twig\d3\d3515c7374c86e1675c9bdc71501583c.php:95)
  at __TwigTemplate_ec9b51ce37f7fdfbb114fb5f8d792795->block_html(array('type' => 'html', 'template' => 'content_element/html', … 

@fritzmg fritzmg added the bug label Mar 23, 2023
@fritzmg fritzmg added this to the 5.1 milestone Mar 23, 2023
@fritzmg fritzmg requested a review from m-vo March 23, 2023 10:55
@fritzmg fritzmg self-assigned this Mar 23, 2023
@m-vo
Copy link
Member

m-vo commented Mar 23, 2023

Should the controller even render the template in this case or just return an empty response (like in the markdown controller)? 🤔

@fritzmg
Copy link
Contributor Author

fritzmg commented Mar 23, 2023

Should the controller even render the template

Yes, because the template could contain other things.

@leofeyer leofeyer merged commit 1d72b51 into contao:5.1 Mar 27, 2023
17 checks passed
@leofeyer
Copy link
Member

Thank you @fritzmg.

@leofeyer leofeyer changed the title Fix html.html.twig template if html is null Handle null in the html.html.twig template Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants