Project

General

Profile

Actions

Bug #77284

closed

USERDEF2 ItemState set through a itemArrayProcFunc is ignored - USERDEF2 TypoScript Conf never used

Added by Stefan Bürk over 8 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Content Rendering
Target version:
-
Start date:
2016-07-28
Due date:
% Done:

100%

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

Description

After setting menuItems in a itemArayProcFunc to ITEM_STATE USERDEF2, the items will be formatted as one of the other states.
USERDEF2 is fully ignored. USERDEF1 and all other states are working.

I looked into the core code, and found the Bug.

The bug sits in the procesItemStates method of TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject Class.

There is a wrong conditional used in the USERDEF2 handling:

// Prepare Userdefined settings
        if (!empty($this->mconf['USERDEF2'])) {
            $USERDEF2conf = null;
            $USERDEF2ROconf = null;
            // Find active
            foreach ($NOconf as $key => $val) {
                if ($this->isItemState('USERDEF2', $key)) {
                    // If this is the first active, we must generate USERDEF2.
                    if ($USERDEF2conf) {
                        $USERDEF2conf = $this->tmpl->splitConfArray($this->mconf['USERDEF2.'], $splitCount);
                        // Prepare active rollOver settings, overriding normal active settings
                        if (!empty($this->mconf['USERDEF2RO'])) {
                            $USERDEF2ROconf = $this->tmpl->splitConfArray($this->mconf['USERDEF2RO.'], $splitCount);
                        }
                    }
                    // Substitute normal with active
                    if (isset($USERDEF2conf[$key])) {
                        $NOconf[$key] = $USERDEF2conf[$key];
                    }
                    // If rollOver on normal, we must apply a state for rollOver on the active
                    if ($ROconf) {
                        // If RollOver on active then apply this
                        $ROconf[$key] = !empty($USERDEF2ROconf[$key]) ? $USERDEF2ROconf[$key] : $USERDEF2conf[$key];
                    }
                }
            }
        }

The buggy condition is:

if ($USERDEF2conf) {

This condition is wrong, because

NULL === TRUE    ==> FALSE

This condition should be changed to

if ($USERDEF2conf === null) {

Found in 7.6.9, but still in the master branch.

Actions #1

Updated by Gerrit Code Review over 8 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/49241

Actions #2

Updated by Gerrit Code Review over 8 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/49241

Actions #3

Updated by Gerrit Code Review over 8 years ago

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

Actions #4

Updated by Stefan Bürk over 8 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