Project

General

Profile

Actions

Bug #98096

closed

Missing null check

Added by JAKOTA Design Group GmbH over 1 year ago. Updated over 1 year ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Code Cleanup
Target version:
-
Start date:
2022-08-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #97816: New TypoScript parserClosed2022-06-27

Actions
Actions #1

Updated by Stefan Bürk over 1 year 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 ?

Actions #2

Updated by JAKOTA Design Group GmbH over 1 year 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.

Actions #3

Updated by Christian Kuhn over 1 year ago

Actions #4

Updated by Christian Kuhn over 1 year 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".

Actions

Also available in: Atom PDF