Bug #33416

Exception thrown by tslib_content->getContentObject when referenced TS objects are empty

Added by Jo Hasenau over 3 years ago. Updated 8 months ago.

Status:Closed Start date:2012-01-24
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:TypoScript Spent time: -
Target version:-
TYPO3 Version:4.5 Is Regression:No
PHP Version:5.3 Sprint Focus:
Complexity:easy

Description

In TypoScript setups you can use the following syntax:

page = PAGE
page {
  10 =< lib.myPageContent
}

Now this is taken by tslib_content->cObjGetSingle and handed over to a recursive call to cObjGetSingle in line 755.
cObjGetSingle expects at least a name and a configuration as parameter, but none of them is getting any default value.

This works as long as the reference is pointing to an existing object:

lib.myPageContent = CONTENT
lib.myPageContent {
  blah
}

But if lib.myPageContent is empty, i.e. due to a condition that removes the object in a certain context, in the next step cObjGetSingle will still call tslib_content->getContentObject but with an empty name.

Since getContentObject won't find any class mapped to this empty name it will try to make an instance of a class 'tslib_content_' . $name - which will of cause lead to an exception.

Now we could call this a "feature" since this will show the users that there is something missing in their TypoScript setup, but IMHO the desired behaviour would be to either only call cObjGetSingle with existing names or use proper defaults for $name and $conf.

Opinions?


Related issues

related to Core - Bug #53682: Exception '$toolbarItem "shortcuts" must implement interf... Resolved 2013-11-15

History

#1 Updated by Ernesto Baschny over 3 years ago

  • Status changed from New to Accepted

Yes, a notice in TSlog (for admin panel) would be sufficient for debugging purposes. And then just return an empty string in these situations, right?

But not an exception, as this will probably break sites which had this situation before upgrading to 4.5.

#2 Updated by Alexander Opitz 8 months ago

  • Status changed from Accepted to Needs Feedback
  • Target version deleted (4.5.12)
  • Is Regression set to No

Hi,

does the problem still exists within newer versions of TYPO3 CMS (6.2.9)?

#3 Updated by Jo Hasenau 8 months ago

Seems to have been accidentally fixed with the latest patch for #53682

#4 Updated by Wouter Wolters 8 months ago

  • Status changed from Needs Feedback to Closed

Also available in: Atom PDF