Issue Bug Closed

#103384PHP Warning: Undefined array key "divKey"

Pascal Geldmacher 03/13/24, 10:06 updated 10/15/24, 09:31

Description

Since TYPO3 12 I get these warnings:

Core: Error handler (FE): PHP Warning: Undefined array key "divKey" in /var/www/html/vendor/typo3/cms-frontend/Classes/Controller/TypoScriptFrontendController.php line 2237
Core: Error handler (FE): PHP Warning: Undefined array key "divKey" in /var/www/html/vendor/typo3/cms-frontend/Classes/Controller/TypoScriptFrontendController.php line 2231
Core: Error handler (FE): PHP Warning: Undefined array key "divKey" in /var/www/html/vendor/typo3/cms-frontend/Classes/Controller/TypoScriptFrontendController.php line 2230

if I use this TypoScript snippet on a specific page:

page.bodyTagCObject {
    998 = TEXT
    998 {
        value = data-etracker-form-category="Sample"
    }

    999 = TEXT
    999 {
        noTrimWrap = | |
        value.cObject = CONTENT
        value.cObject {
            table = tx_ofproduct_domain_model_article
            select {
                selectFields = title
                uidInList = {session:sample}
                uidInList.insertData = 1
                pidInList = 0
                max = 1
            }

            renderObj = COA_INT
            renderObj {
                10 = TEXT
                10 {
                    field = title
                    noTrimWrap = | data-etracker-form-object="|" |
                }
            }
        }
    }
}

If I remove the part with the COA_INT I don’t get these warnings.

Reviews 2

History 610

  1. Georg Ringer commented 03/15/24, 12:10

    can you copy which lines are on the specific line number as I can’t reproduce it here

  2. Pascal Geldmacher commented 03/19/24, 10:34

    That’s the lines in the TYPO3 Core where I get the warnings:

    $this->content = str_replace(
                [
                    '<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->',
                    '<!--FD_' . $this->config['INTincScript_ext']['divKey'] . '-->',
                ],
                [
                    implode(LF, $this->additionalHeaderData),
                    implode(LF, $this->additionalFooterData),
                ],
                $this->pageRenderer->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config['INTincScript_ext']['divKey'])
            );

    in this function:

     public function INTincScript(ServerRequestInterface $request): void
        {
            $this->additionalHeaderData = $this->config['INTincScript_ext']['additionalHeaderData'] ?? [];
            $this->additionalFooterData = $this->config['INTincScript_ext']['additionalFooterData'] ?? [];
            if (empty($this->config['INTincScript_ext']['pageRendererState'])) {
                $this->initPageRenderer();
            } else {
                $pageRendererState = unserialize($this->config['INTincScript_ext']['pageRendererState'], ['allowed_classes' => [Locale::class]]);
                $this->pageRenderer->updateState($pageRendererState);
            }
            if (!empty($this->config['INTincScript_ext']['assetCollectorState'])) {
                $assetCollectorState = unserialize($this->config['INTincScript_ext']['assetCollectorState'], ['allowed_classes' => false]);
                GeneralUtility::makeInstance(AssetCollector::class)->updateState($assetCollectorState);
            }
    
            $this->recursivelyReplaceIntPlaceholdersInContent($request);
            $this->getTimeTracker()->push('Substitute header section');
            $this->INTincScript_loadJSCode();
            $this->generatePageTitle();
    
            $this->content = str_replace(
                [
                    '<!--HD_' . $this->config['INTincScript_ext']['divKey'] . '-->',
                    '<!--FD_' . $this->config['INTincScript_ext']['divKey'] . '-->',
                ],
                [
                    implode(LF, $this->additionalHeaderData),
                    implode(LF, $this->additionalFooterData),
                ],
                $this->pageRenderer->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config['INTincScript_ext']['divKey'])
            );
            // Replace again, because header and footer data and page renderer replacements may introduce additional placeholders (see #44825)
            $this->recursivelyReplaceIntPlaceholdersInContent($request);
            $this->setAbsRefPrefix();
            $this->getTimeTracker()->pull();
        }
  3. Gerrit Code Review pushed patch set 1 for main to change 83525 status New Under Review 03/19/24, 15:18

  4. Georg Ringer commented 03/19/24, 15:19

    tested it with

    page.bodyTagCObject = COA
    page.bodyTagCObject {
        998 = TEXT
        998 {
            value = data-etracker-form-category="Sample" 
        }
    
        999 =COA_INT
        999 {
    
          10 = TEXT
          10.value = abc
        }
    }

    thanks for your feedback!

  5. Georg Ringer changed Duplicated by #104251 06/28/24, 20:00

  6. Gerrit Code Review pushed patch set 2 for main to change 83525 09/19/24, 22:34

  7. Gerrit Code Review pushed patch set 3 for main to change 83525 09/19/24, 22:35

  8. Gerrit Code Review pushed patch set 1 for 12.4 to change 86218 09/20/24, 09:48

  9. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 09/20/24, 10:00

    Applied in changeset commit:d7060dd37057363646fda85bb4420cd8e369d592.

  10. Benni Mack changed status Resolved Closed 10/15/24, 09:31