Project

General

Profile

Actions

Bug #59959

closed

LiveSearchToolbarItem not initialized correctly in \sysext\backend\Classes\Controller\BackendController.php

Added by Gernot Schulmeister over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2014-06-28
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

in the function initializeCoreToolbarItems() line 138 the path to the LiveSearchToolbarItem class is not set correctly but escaped with a double back slash at the beginning (line 142), compare with the Shortcut and ClearCache Toolbar Items

$coreToolbarItems = array(
'shortcuts' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem',
'clearCacheActions' => 'TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheToolbarItem',
'liveSearch' => '\\TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'
);

The consequence is that the LiveSearchToolbarItem Class cannot be extended (former XClass) using the naming conventions because the Extension class is not detected by the GeneralUtility:makeInstance() function. So

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'] = array('className' => 'somePath');

will not work, instead you have to use

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['\TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'] = array('className' => 'somePath');

to get the LiveSearchToolbarItem class extended at the moment.

protected function initializeCoreToolbarItems() {
$coreToolbarItems = array(
'shortcuts' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem',
'clearCacheActions' => 'TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheToolbarItem',
'liveSearch' => '\\TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem'
);
foreach ($coreToolbarItems as $toolbarItemName => $toolbarItemClassName) {
$toolbarItem = GeneralUtility::makeInstance($toolbarItemClassName, $this);
if (!$toolbarItem instanceof \TYPO3\CMS\Backend\Toolbar\ToolbarItemHookInterface) {
throw new \UnexpectedValueException('$toolbarItem "' . $toolbarItemName . '" must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ToolbarItemHookInterface', 1195126772);
}
if ($toolbarItem->checkAccess()) {
$this->toolbarItems[$toolbarItemName] = $toolbarItem;
} else {
unset($toolbarItem);
}
}
}

Solution remove the first \\ in line 142 to make an instance of the LiveSearchToolbarItem

Actions #1

Updated by Gerrit Code Review over 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31475

Actions #2

Updated by Gerrit Code Review over 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31475

Actions #3

Updated by Gerrit Code Review over 10 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31477

Actions #4

Updated by Gernot Schulmeister over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF