Bug #104963
closedUndefined array key 0 exception in FullRecordContainer
100%
Description
The opening of IRRE records ends in an Exception:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1476107295: PHP Warning: Undefined array key 0 in /path/typo3_src-13.2.1.test/typo3/sysext/backend/Classes/Form/Container/FullRecordContainer.php line 47 | TYPO3\CMS\Core\Error\Exception thrown in file /path/typo3_src-13.2.1.test/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 138. Requested URL: https://demo13.website.com/typo3/ajax/record/inline/details?token=--AnonymizedToken--
Files
Updated by Garvin Hicking 5 months ago
- Status changed from New to Needs Feedback
Thanks for the report!
Can you please provide a minimal example to reproduce this, mabye using EXT:styleguide as an example? What do I need to click where to reproduce it?
Updated by Franz Holzinger 5 months ago
You can reproduce this in tt_products. Create a product and some articles inside of the IRRE relation of the product.
Updated by Garvin Hicking 5 months ago
Thanks for the feedback. If you are able to provide a smaller, isolated example at some point, we might be able to help. tt_products is too big and loaded with dependencies we cannot properly debug within reasonable time.
Updated by Stefan Bürk 5 months ago
I guess we could here add an early check if the expolded array does not contain any elements:
$fieldsArray = GeneralUtility::trimExplode(',', $itemList, true);
// add here a $fieldsArray === [] check and return early - or ensure that handling below is guarded properly
// Streamline the fields array
// First, make sure there is always a --div-- definition for the first element
if (!str_starts_with($fieldsArray[0], '--div--')) {
array_unshift($fieldsArray, '--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general');
Thanks for reportng this. Not sure how this occured or can be reproduced, but guarding that make sense I guess.
Updated by Garvin Hicking 5 months ago
Unsure about this. The rest of the method really expects that fieldArray contains information. The method returns something vital which an 'early return' IMO would break.
This kind of sounds to me like a TCA misconfiguration issue. I think we need an EXT:styleguide reproducible example for it first.
Updated by Stefan Bürk 5 months ago
Garvin Hicking wrote in #note-5:
Unsure about this. The rest of the method really expects that fieldArray contains information. The method returns something vital which an 'early return' IMO would break.
This kind of sounds to me like a TCA misconfiguration issue. I think we need an EXT:styleguide reproducible example for it first.
ack. should not investigate such things laying tired on hells floor - being there now again ;)
Could you please fully dump / save the content of $this->data before the `if (!str_starts_with(....` when $fieldArray is an empty array ?
Something like
$fieldsArray = GeneralUtility::trimExplode(',', $itemList, true);
//--------------------------------------
file_put_contents(
\TYPO3\CMS\Core\Core\Environment::getVarPath() . '/empty-field-array-in-full-record-container.json',
\json_encode($this->data, JSON_PRETTY_PRINT),
);
//--------------------------------------
if (!str_starts_with($fieldsArray[0], '--div--')) {
Updated by Franz Holzinger 4 months ago
- File empty-field-array-in-full-record-container.json empty-field-array-in-full-record-container.json added
This error also happens in TYPO3 12.
Updated by Benni Mack 4 months ago
Hey Franz,
you can actually fix this by using this configuration in your parent table when defining the type=inline:
'appearance' => [
'collapseAll' => 1,
]
if you don't have any visible fields in your child table, then collapseAll should be sufficient
Updated by Franz Holzinger 4 months ago
· Edited
I have tried it out:
'article_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:' . $extensionKey . $languageSubpath . 'locallang_db.xlf:' . $table . '.article_uid',
'config' => [
'type' => 'inline',
'appearance' => [
'collapseAll' => true,
// 'newRecordLinkAddTitle' => true,
// 'useCombination' => true,
],
'foreign_table' => 'tt_products_products_mm_articles',
'foreign_field' => 'uid_local',
'foreign_sortby' => 'sorting',
'foreign_label' => 'uid_foreign',
'foreign_selector' => 'uid_foreign',
'foreign_unique' => 'uid_foreign',
'maxitems' => 1000,
'default' => 0,
],
],
No difference. There is still the same error message.
Updated by Franz Holzinger 4 months ago
This commit fixes this issue.
Updated by Benni Mack 4 months ago
Thanks, I suggest closing this ticket now, and actually adding some information to docs.typo3.org that showitem should include at least one field. OK?
Updated by Franz Holzinger 4 months ago
It would be more helpful if TYPO3 could warn about this (log file or somewhere else) or even throw an exception in such a case like this one.
Updated by Gerrit Code Review 3 months ago
- Status changed from Needs Feedback to Under Review
Patch set 3 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/+/86806
Updated by Gerrit Code Review 3 months ago
Patch set 1 for branch 13.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86862
Updated by Oliver Bartsch 3 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 4cd861c5220b7734161f61d1fd2f8ec8fd3e4ab0.