Project

General

Profile

Actions

Bug #102846

closed

Error with pidList in suggestOptions for group field in FlexForms

Added by Stefan Terborg 10 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-01-17
Due date:
% Done:

100%

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

Description

When I add suggestOptions for a group field in a content flexform, the search returns no results.

The ajax request returns a warning:
PHP Warning: Undefined array key "" in vendor/typo3/cms-backend/Classes/Controller/Wizard/SuggestWizardController.php line 62

When I debug the code it turns out that the

$parsedBody = $request->getParsedBody();
is null so that the data will never be evaluated as flexform
if (empty($dataStructureIdentifier)) {

is always true.

Actions #1

Updated by Stefan Terborg 10 months ago

  • Subject changed from SuggestOptions for group field in FlexForms broken to Error with pidList in suggestOptions for group field in FlexForms

I´m sorry, it seems I looked at the wrong place. ParsedBody is not null and the suggest options work.

Instead there seems to be a problem with <pidList> causing the following error:

Argument #2 must be of type array, int given, in file vendor/typo3/cms-backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php:115

Example code:

...
<suggestOptions>
    <default>
        <pidList>33,41</pidList>
    </default>
</suggestOptions>
...

Or maybe I'm missing some option for the usage with pidList.

Actions #2

Updated by Kai Strecker 7 months ago

  • Complexity set to no-brainer

I have also just come across this bug.

As Stefan Terborg already pointed out, the cause is vendor/typo3/cms-backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php:115, which is this line of code:

$this->allowedPages = array_unique(array_merge($this->allowedPages, ...$availablePageIds));

The bug here is that $availablePageIds is a one-dimensional array. Therefore, the use of ... to pass the array values to array_merge is incorrect. The fix is to simply remove ...:
$this->allowedPages = array_unique(array_merge($this->allowedPages, $availablePageIds));

After doing this patch, the suggest wizard worked fine in my TYPO3 instance.

Actions #3

Updated by Georg Ringer 5 months ago

can be tested in styleguide in:

  • flexforms: flex_1 > group_db_2
  • tca: group_db_10
Actions #4

Updated by Gerrit Code Review 5 months 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/+/84629

Actions #5

Updated by Gerrit Code Review 4 months 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/+/84629

Actions #6

Updated by Gerrit Code Review 4 months ago

Patch set 1 for branch 12.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/+/85202

Actions #7

Updated by Georg Ringer 4 months ago

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

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF