Open s-diez opened 6 years ago
I would also say this is a bug. At least it leads to problem when you with with strict types and expect render()
to return a string.
Agreed, but I think the right solution is to correct the return type annotation to string|null
- it is nice to be able to tell if the template truly didn't cause any output at all, versus if it did render a template but the result was an empty string. Among other things this is used in f:render
to determine if the default/fallback representation should be returned if for example a non-existing partial or section was rendered but optional=true
was requested.
If you render empty template files for example through
TYPO3\CMS\Fluid\View\StandaloneView
you getnull
as the return. This is kind of unexpected as the documentation ofTYPO3Fluid\Fluid\View\AbstractTemplateView::render()
has a return of typestring
. Furthermore if you do not expect this and try to cache the output inTYPO3\CMS\Core\Cache\Frontend\StringFrontend
it will never be cached, asnull
can not be cached by it.Especially because of the documentation and the interaction with the cache, I would consider this a bug.