Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Metadata values should be of type array, but are string #1308

Open
beatrycze-volk opened this issue Aug 16, 2024 · 1 comment
Open
Assignees
Labels
🐛 bug A non-security related bug.

Comments

@beatrycze-volk
Copy link
Collaborator

Description

The value passed to the foreach loop is a string, but should be an array.

Reproduction

Steps to reproduce the behaviour:

  1. Install TYPO3 11.x with PHP 8.x
    Click on link to display document page e.g. https://dfgviewer-dist.ddev.site
    See error

Expected Behavior

The values should be stored as arrays or their usage should be adjusted to handle the strings. But the first option is more advisable as imploding and next exploding the array looks like not the most appropriate approach.

Screenshots and Examples

langerror

Environment

  • RDBMS version: MariaDB 10.3
  • TYPO3 version: 11.5.37
  • PHP version: 8.2

Additional Context

This line introduces value type change:

    $metadata[$i][$name] = is_array($value)
        ? implode($this->settings['separator'], $value)
        : $value;

But usages of those values are not adjusted e.g:

    foreach ($metadata[$i][$name] as &$langValue) {
        $langValue = Helper::getLanguageName($langValue);
    }
@sebastian-meyer sebastian-meyer added the 🐛 bug A non-security related bug. label Aug 19, 2024
@sebastian-meyer sebastian-meyer changed the title [BUG] Recent adjustment of musical sources changes values stored in metadata array but not their usage [BUG] Metadata values should be of type array, but are string Aug 20, 2024
@sebastian-meyer
Copy link
Member

sebastian-meyer commented Sep 20, 2024

There is a preliminary fix in #1339, but this only fixes non-hierarchical metadata. See this for details:

// PHPStan error
// I don't understand what this code does, so I take it away until author can fix it
/*if ($metadata[$i][$name][0] === 'Array') {
$metadata[$i][$name] = [];
foreach ($value as $subKey => $subValue) {
$metadata[$i][$name][$subKey] = $subValue;
}
}*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug A non-security related bug.
Projects
None yet
Development

No branches or pull requests

3 participants