Project

General

Profile

Actions

Bug #67183

closed

Exception in \TYPO3\CMS\Frontend\Aspect\FileMetadataOverlayAspect::languageAndWorkspaceOverlay

Added by André Spindler almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2015-05-28
Due date:
% Done:

0%

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

Description

Error is "Passed variable is not an array or object, using empty array instead" in line "$data->exchangeArray($overlayedMetaData);"

I got this exception today in a workspace preview - it is the cause of an type error. check in the line above must be done against FALSE, not NULL.
TYPO3: 6.2.12
PHP: 5.3.10-1ubuntu3.18

Code:

$overlaidMetaData = $data->getArrayCopy();
$this->getTsfe()->sys_page->versionOL('sys_file_metadata', $overlaidMetaData);
$overlaidMetaData = $this->getTsfe()->sys_page->getRecordOverlay(
    'sys_file_metadata',
    $overlaidMetaData,
    $this->getTsfe()->sys_language_content,
    $this->getTsfe()->sys_language_contentOL
);
if ($overlaidMetaData !== NULL) {
    $data->exchangeArray($overlaidMetaData);
}

If there is no overlay, versionOL() sets the given data array ($overlaidMetaData) to FALSE (instead of unset() it).
So FALSE is passed to getRecordOverlay() as second parameter. But if it is not an array (as has no index "uid"), getRecordOverlay() does just nothing (ok, hooks are processed) and returns just this FALSE.
So we run into the exception when FALSE is checked against NULL - and it indeed not NULL and we replace the data of the array object with FALSE...

So it is just a small fix to replace NULL in the check with FALSE.

Actions

Also available in: Atom PDF