Project

General

Profile

Actions

Bug #99846

closed

PHP Warning in FlexFormService.php

Added by Ralph Brugger almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2023-02-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

We've got a warning in

typo3/sysext/core/Classes/Service/FlexFormService.php

public function convertFlexFormContentToArray($flexFormContent, $languagePointer = 'lDEF', $valuePointer = 'vDEF')

foreach (array_values($flexFormArray) as $languages) {
    if (!is_array($languages[$languagePointer])) {
        continue;
    }

could / should be:

foreach (array_values($flexFormArray) as $languages) {
    if (isset($languages[$languagePointer])){
      if (!is_array($languages[$languagePointer])) {
          continue;
      }

Actions #1

Updated by Chris Müller almost 2 years ago

Can you also state which warning and giving a context? I assume, something with "undefined array key"?

Actions #2

Updated by Ralph Brugger almost 2 years ago

Sorry, yes:

Core: Error handler (FE):
PHP Warning: Undefined array key "lDEF" in typo3/sysext/core/Classes/Service/FlexFormService.php line 44

The context is not completely clear.
It occures when rendering one of many simple CEs.

Actions #3

Updated by Gerrit Code Review almost 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77789

Actions #4

Updated by Gerrit Code Review almost 2 years ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77789

Actions #5

Updated by Sybille Peters almost 2 years ago

@Ralph Apart from the patch, it would be good if you could check what caused the error. Possibly the flexform is invalid.

You can look in tt_content.pi_flexform in the database for the affected content element.

There are also a number of tools / code in TYPO3 to cleanup flexform and convert flexform. If you have several with a similar problem, you can write yourself an upgrade wizard or command line tool to fix the existing flexforms.

There is also the TYPO3 command line tool cleanup:flexforms (in system extension EXT:lowlevel) - but this may not help if the Flexform already is invalid. ("Updates all database records which have a FlexForm field and the XML data does not match the chosen datastructure.")

Before running these commands you should backup your database or preferably try them on a test system first

On Composer:

php vendor/bin/typo3 cleanup:flexforms

Non Composer:

php typo3/sysext/core/bin/typo3 cleanup:flexforms

Use -h for help, --dry-run for dry run (do not change).

Documentation EXT:lowlevel

Actions #6

Updated by Ralph Brugger almost 2 years ago

@Sybille Peters
You're absolutely right.
We're trying that, finding the cause and trying to cleanup these errrors.

This is a very large project with about 10.400 pages, 51.000 press messages, 100 editors and so on.

The editors are responsible for the content we're supporting this project since over 10 years.

So we'll never reach the state of error free content elements.
But we're trying:)

Actions #7

Updated by Gerrit Code Review almost 2 years ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77755

Actions #8

Updated by Sybille Peters almost 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Sybille Peters almost 2 years ago

@Ralph The core already takes care of a lot of migrations in upgrade wizard and you can use the lowlevel commands. But in my experience, there is always some stuff you need to fix yourself, especially in installations with several extensions existing over several years. (Also depends on how much editors are allowed to edit freely).

You can also check out DB Doctor: https://packagist.org/packages/lolli/dbdoctor

Actions #10

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF