Bug #99846
closedPHP Warning in FlexFormService.php
100%
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;
}
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"?
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.
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
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
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).
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:)
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
Updated by Sybille Peters almost 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 54d10c1c5d8f27f5856cca0b4d157c67a43c5717.
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