-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
I got a case where a template was doing {{ value }} and received an empty array as value (due to a bug in my code). The stack trace for that was totally useless:
In the old buffer-based architecture, converting the array to a string would happen in the compiled template at the location of this {{ value }}, allowing to debug this.
The new architecture documents that Template::doDisplay should return an iterable<scalar|\Stringable|null>, but the compiled code does not actually ensure this is respected. PrintNode does not ensure that the expression result satisfies that type before yielding it.
This has 2 impact:
- when using
TemplateWrapper::renderorTemplateWrapper::display(or the equivalent block-related methods), you will get warning with a useless stack trace (see my example) - when using
TemplateWrapper::stream(orTemplateWrapper::streamBlock), the returned iterable will not satisfy the contract (and whether you get an error or warning will depend on how the iterable is consumed, but it won't have a stack trace reaching to the root cause in the PrintNode).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels