Skip to content
Snippets Groups Projects
Commit 062e850f authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Benni Mack
Browse files

[BUGFIX] Prevent TypeError in CreateRecordReactionTable

The `items` array in an itemsProcFunc does no
longer contain item arrays but SelectItem objects.
Therefore, the corresponding type hint is changed
in CreateRecordReactionTable and the code usages
are adjusted to prevent a TypeError.

Resolves: #100242
Related: #99739
Releases: main
Change-Id: I05be3bd33a816a6f957032d1482c37b3c33cbf9d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78205


Reviewed-by: default avatarFrank Nägler <frank.naegler@typo3.com>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarFrank Nägler <frank.naegler@typo3.com>
parent 78cb4e2b
Branches
Tags
No related merge requests found
......@@ -32,7 +32,7 @@ class ReactionItemsProcFunc
public function validateAllowedTablesForExternalCreation(array &$fieldDefinition): void
{
foreach ($fieldDefinition['items'] as $key => $item) {
if (!CreateRecordReactionTable::fromProcFuncItem($item)->isAllowedForItemsProcFunc()) {
if (!CreateRecordReactionTable::fromSelectItem($item)->isAllowedForItemsProcFunc()) {
unset($fieldDefinition['items'][$key]);
}
}
......
......@@ -17,6 +17,8 @@ declare(strict_types=1);
namespace TYPO3\CMS\Reactions\Validation;
use TYPO3\CMS\Core\Schema\Struct\SelectItem;
/**
* Validation class for tables to be allowed for record creation in the "create record" reaction
*
......@@ -28,9 +30,9 @@ final class CreateRecordReactionTable
{
}
public static function fromProcFuncItem(array $procFuncItem): CreateRecordReactionTable
public static function fromSelectItem(SelectItem $selectItem): CreateRecordReactionTable
{
return new self((string)($procFuncItem[1] ?? ''));
return new self((string)$selectItem->getValue());
}
public function isAllowedForCreation(): bool
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment