You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've set-up a small test-case that demonstrates a hick-up the Twig_String_Loader currently has: it doesn't process properties that user underscores in their name, using {{ foo.acme_string }} to access $acme_string will fail with
Twig_Error_Runtime: Method "acme_string"
for object "Tests\Foo" does not exist
in "{{ foo.int }}, {{ foo.acme_string }}"
Although as per doc-comment on the Loader\String the loader should only be used for testing purposes this should work anyway. Else it is not really suitable for testing.
The text was updated successfully, but these errors were encountered:
Well, actually, the Twig_Loader_Array is more suitable for testing purpose. The Twig_Loader_String does not allow extending another template (well, unless you put the content of the parent template in the {% extends %} tag, which makes it useless). The actual use case for the string loader is template_from_string().
but your own issue has nothing to do with the string loader. foo.acme_string does not work for other loaders either (it has nothing to do with the template loading btw). It looks like you expect the behavior of https://github.com/fabpot/Twig/pull/1299, but this Pr is not merged
I've set-up a small test-case that demonstrates a hick-up the Twig_String_Loader currently has: it doesn't process properties that user underscores in their name, using
{{ foo.acme_string }}
to access$acme_string
will fail withAlthough as per doc-comment on the Loader\String the loader should only be used for testing purposes this should work anyway. Else it is not really suitable for testing.
The text was updated successfully, but these errors were encountered: