Project

General

Profile

Actions

Bug #31139

closed

better condition in versionOL of t3lib_tstemplate

Added by Stefan Froemken over 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
Start date:
2011-10-20
Due date:
% Done:

100%

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

Description

Hello Core-Team,

in current TYPO3 4.5.7 you have following method in class.t3lib_tstemplate.php:

function versionOL(&$row) {
    if (is_object($GLOBALS['TSFE'])) { // Frontend:
        $GLOBALS['TSFE']->sys_page->versionOL('sys_template', $row);
    } else { // Backend:
        t3lib_BEfunc::workspaceOL('sys_template', $row);
    }
}

You only need to set something:
$GLOBALS['TSFE']->register['hello'] = 1;
or play with cObj in BE Mode and $GLOBALS['TSFE'] get's a value.

In this case is_object($GLOBALS['TSFE']) returns true, because it is of class stdClass now.

So...to prevent calling $GLOBALS['TSFE']->sys_page->versionOL in BE-Mode it's better to modify the condition that way:

function versionOL(&$row) {
    if (isset($GLOBALS['TSFE']) && is_object($GLOBALS['TSFE']) && get_class($GLOBALS['TSFE']) == 'tslib_fe') { // Frontend:
        $GLOBALS['TSFE']->sys_page->versionOL('sys_template', $row);
    } else { // Backend:
        t3lib_BEfunc::workspaceOL('sys_template', $row);
    }
}

Stefan


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #36981: Regression of "better condition in versionOL of t3lib_tstemplate" (#31139)ClosedAndy Grunwald2012-05-09

Actions
Has duplicate TYPO3 Core - Bug #25144: Incorrect check for fe / be context in class.t3lib_tstemplate.phpClosed2011-02-23

Actions
Actions

Also available in: Atom PDF