Empty tpl's vs. missing tpl's
wuuti opened this issue · 1 comments
I realized an unexpected behaviour at a live site, which was triggered by an empty tpl chunk. It took me a while to realize the problem.
In brief: even if you correctly define a tpl chunk, no typos etc, the AOD (array of death :-)) is returned, if the tpl chunk is empty. The problem does not arise, if there is anything inside that template chunk, even a single space is sufficient! Can be reproduced very straightforward.
One can argue that empty chunks are nonsens, but the behaviour nevertheless is unexpected. And, in my case, the chunk contained a simple output filter like:
[[+tv.sometv:isnot=
(there were special reasons not to use a resource filter for this).X
:then=Y
:else=``]]
While developing this caused no trouble, because every tv value was set with something (in fact it was an cliche image tv). In production there was one day, when one value at a resource was not set - and the AOD was shown.
I believe, that empty tpl chunks - no matter if left blank intentionally or dynamically by a filter like the one above - should not output the array, but nothing, as intended by the empty chunk.