Project

General

Profile

Actions

Bug #67757

closed

Sanity check is missing within MediaContentObject

Added by Thilo Schumann over 9 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2015-06-25
Due date:
% Done:

100%

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

Description

In the file MediaContentObject.php Line 299 and Line 301 there are the sanity checks missing, which will trigger an PHP warning, which will produce an error.

https://typo3.org/api/typo3cms/_media_content_object_8php_source.html#l00299
https://typo3.org/api/typo3cms/_media_content_object_8php_source.html#l00301

The function explanation itself tells it will lookup the keys and if not present will use the defaults. <https://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_frontend_1_1_content_object_1_1_media_content_object.html#a680af7dc67ac0db3435f864aea3f05e5>

But it does not really checks for presence. It just assumes.

Original:

  295       protected function doFlexFormOverlay(array &$confArray, $key, $sectionKey = NULL) {
  296                 $flexValue = NULL;
  297                 $flexKey = 'mm' . ucfirst($key);
  298                 if ($sectionKey === NULL) {
  299                         $flexValue = $confArray['parameter.'][$flexKey];
  300                 } else {
  301                         $flexValue = $confArray['parameter.'][$flexKey][$sectionKey];
  302                 }
  303                 if ($flexValue === NULL) {
  304                         $flexValue = isset($confArray[$key . '.']) ? $this->cObj->stdWrap($confArray[$key], $confArray[$key . '.']) : $confArray[$key];
  305                 }
  306                 return $flexValue;
  307         }
  308

Changed:
        protected function doFlexFormOverlay(array &$confArray, $key, $sectionKey = NULL) {
                $flexValue = NULL;
                $flexKey = 'mm' . ucfirst($key);
                if ($sectionKey === NULL) {
                        if (is_array($confArray['parameter.']))
                                $flexValue = $confArray['parameter.'][$flexKey];
                } else {
                        if (is_array($confArray['parameter.']) && is_array($flexValue = $confArray['parameter.'][$flexKey]))
                                $flexValue = $confArray['parameter.'][$flexKey][$sectionKey];
                }
                if ($flexValue === NULL) {
                        $flexValue = isset($confArray[$key . '.']) ? $this->cObj->stdWrap($confArray[$key], $confArray[$key . '.']) : $confArray[$key];
                }
                return $flexValue;
        }

Actions #1

Updated by Christian Kuhn over 9 years ago

thx. sounds valid.

Actions #2

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from New to Under Review

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/45112

Actions #3

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 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/45112

Actions #4

Updated by Thilo Schumann almost 9 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