Project

General

Profile

Actions

Bug #33416

closed

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

Added by Jo Hasenau over 12 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2012-01-24
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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 1 (0 open1 closed)

Related to TYPO3 Core - Bug #53682: Exception '$toolbarItem "shortcuts" must implement interface ...\ToolbarItemHookInterface'Closed2013-11-15

Actions
Actions #1

Updated by Ernesto Baschny over 12 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.

Actions #2

Updated by Alexander Opitz over 9 years 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)?

Actions #3

Updated by Jo Hasenau over 9 years ago

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

Actions #4

Updated by Wouter Wolters over 9 years ago

  • Status changed from Needs Feedback to Closed
Actions

Also available in: Atom PDF