Project

General

Profile

Actions

Bug #73872

closed

Invalid argument supplied for foreach in PageLayoutView

Added by Dmitry Dulepov over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Should have
Category:
Backend User Interface
Target version:
-
Start date:
2016-03-02
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Yes
Sprint Focus:

Description

Getting a warning:

PHP Warning
Core: Error handler (BE): PHP Warning: Invalid argument supplied for foreach() in /home/***/vendor/typo3/cms/typo3/sysext/backend/Classes/View/PageLayoutView.php line 1802

Code in question is:

        foreach ($this->contentElementCache[$lP][$colPos] as $record) {
            $key = array_search($record['t3_origuid'], $defLanguageCount);
            if ($key !== false) {
                unset($defLanguageCount[$key]);
            }
        }

It looks like it should be checked that it is an array before looping.

This is function newLanguageButton, when "Languages" is selected instead of "Columns" in the Page module.


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Bug #73670: Page Module: View broken with localized (flux) content elements.Closed2016-02-25

Actions
Actions #1

Updated by Mathias Schreiber over 8 years ago

  • Status changed from New to Needs Feedback
  • Assignee set to Mathias Schreiber

Can you provide a bit more details on where content elements are located?
I'd like to understand the current setup because this case should not happen on a straight core.

Actions #2

Updated by Dmitry Dulepov over 8 years ago

When I debugged that cache was empty for colPos=0. The whole $this->contentElementCache was empty. Content uses fluidcontent/flux from fluidtypo3.org

Actions #3

Updated by Mathias Schreiber over 8 years ago

I've set up a page like this:
Two content positions (colpos 0 and 1).
Two languages (english and german).

I now have a CE in language german in colpos 1.
No error here.
Are we 100% sure this is a core problem and not related to flux?

Actions #4

Updated by Dmitry Dulepov over 8 years ago

I cannot be 100% sure but if it was my code, I would make a simple check in the code:

if (isset($this->contentElementCache[$lP][$colPos])) {
foreach ($this->contentElementCache[$lP][$colPos] as $record) {
$key = array_search($record['t3_origuid'], $defLanguageCount);
if ($key !== false) {
unset($defLanguageCount[$key]);
}
}
}

It never hurts to be careful. Customers complain. I could solve this with Xclass for us but the function is long and I will have to overwrite it completely. I prefer that the code is safe in the core.

Actions #5

Updated by Dmitry Dulepov over 8 years ago

There is one element, which is not translated as usual but created separately in the non-default language. This is the only difference with pages where the warning does not appear. May be, this will help.

Actions #6

Updated by Mathias Schreiber over 8 years ago

  • Status changed from Needs Feedback to Closed
Actions #7

Updated by Dmitry Dulepov over 8 years ago

Sorry, why is it closed without reason?

Oh, I see it is a duplicate of #73670. Thanks!

Actions

Also available in: Atom PDF