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

createTemplate with empty string #1892

Closed
peterrehm opened this issue Oct 27, 2015 · 1 comment
Closed

createTemplate with empty string #1892

peterrehm opened this issue Oct 27, 2015 · 1 comment

Comments

@peterrehm
Copy link

As discussed in #1706 and #1641 (comment) the way to render strings is as follows:

$string = 'Hello, {{ name }}';
$template = $env->createTemplate($string);
echo $template->render(array('name' => 'Bob')); // Hello, Bob

A common use case for this is customization based on user input. However if you render user input it could happen that the template is empty which leads to errors if you then call render on that template.

I am seeing the error as follows:

Template "__string_template__da47b0fa50ef004786efc7745172ce3402223a0f96b70d8f9d0bbbc2f70589a7" is not defined.

I would assume even if you pass an empty string as template everything should work, if I use a normal template the content could be empty as well. If someone confirms I might be able to look into this.

@peterrehm
Copy link
Author

Closing the issue as per #1936 a fix is not wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant