Bug #98096
closedMissing null check
0%
Description
Hi,
The function getTypoScriptFrontendController() in typo3/sysext/core/Classes/TypoScript/TemplateService.php returns TypoScriptFrontendController or null.
But null is not always checked before use.
Like in the same file line 407
if ($this->getTypoScriptFrontendController()->all) {
should be like
if ($this->getTypoScriptFrontendController()?->all) {
or depending on the coding style..
if ($this->getTypoScriptFrontendController()?->all ?? false) {
And this is not the only case.
Updated by Stefan Bürk over 2 years ago
yes and no - in the end, using the TemplateService without proper setup or TSFE does not make much sense. Should be better enforced that tsfe must be set instead of loosing up these checks.
May you explain in which constellation / setup you trap into this errors ?
Updated by JAKOTA Design Group GmbH over 2 years ago
This happened in a middleware request. And a form TS was not setup correctly. I'll ask my colleague for the exact steps to reproduce this.
But the point is that if a function is allowed to return null any code that relies on that should be null safe. Or returning null should be removed.
Updated by Christian Kuhn almost 2 years ago
- Related to Feature #97816: New TypoScript parser added
Updated by Christian Kuhn almost 2 years ago
- Status changed from New to Rejected
TemplateService has been fully deprecated with v12. I don't think it makes too much sense to continue fiddling here, except an important bug is raised in v11. I'll close here for now with "wont fix".