Project

General

Profile

Actions

Bug #96516

closed

LocalizationUtility::flattenTypoScriptLabelArray() exception if TypoScript numerous key is interpreted as integer

Added by Bastian Stargazer almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2022-01-11
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

Some numerous TypoScript keys inside the page {...} array making randomly problems. But for unclear reasons, sometime such numerous TS key is interpreted as integer by PHP, throwing the following exception:

Argument 2 passed to TYPO3\CMS\Extbase\Utility\LocalizationUtility::flattenTypoScriptLabelArray() must be of the type string, int given, called in /var/www/html/public/typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php on line 244

// later in the call-stack:
at TYPO3\CMS\Extbase\Utility\LocalizationUtility::flattenTypoScriptLabelArray(
  array(
    'layoutRootPaths' => array('EXT:my_ext/Resources/Private/Extensions/Cookieman/Layouts/'),
    'templateRootPaths' => array('EXT:my_ext/Resources/Private/Extensions/Cookieman/Templates/'),
    'partialRootPaths' => array('EXT:my_ext/Resources/Private/Extensions/Cookieman/Partials/')
  ), 1365499) // <== here its clearly to see that the key is interpreted as interger (should be '1365499')

As example, I had this issue with the EXT:cookieman v2.9.6 which uses the following TypoScript setup:


page {
  1365499 = FLUIDTEMPLATE
  1365499 {
    // ...
  }
}

But even if I remove this extension and clearing the cache, this error will occur on other numerous keys. This happened from one day to the other in a working project. Even returning to a repository state which was 100% flawless before, the exception is thrown. Probably it has to do with a system-update or so?!

Anyway, a very easy solution is to cast the $labelKey to string:

LocalizationUtility line 244:

$labelValue = self::flattenTypoScriptLabelArray($labelValue, (string)$labelKey);

Actions #1

Updated by Bastian Stargazer almost 3 years ago

  • Description updated (diff)
Actions #2

Updated by Bastian Stargazer almost 3 years ago

This exception was a result of a malformed TypoScript, because a TS constant variable was missing. (The mistake was inside a TS template, thats why reversing back to an earlier repository state had no effect).

Can be closed, sorry.

Actions #3

Updated by Georg Ringer almost 3 years ago

  • Status changed from New to Closed

closed as requested

Actions

Also available in: Atom PDF