Bug #97088
closedTypeError in EXT:core/Classes/Hooks/TcaItemsProcessorFunctions::populateExplicitAuthValues()
100%
Description
EXT:core/Classes/Hooks/TcaItemsProcessorFunctions::populateExplicitAuthValues() can't handle integer types.
Steps to reproduce¶
1. Add an item to a column ($field
) defined as $GLOBALS['TCA'][$table]['ctrl']['type']
having $GLOBALS['TCA'][$table]['columns'][$field]['config']['authMode']
, e.g. a new CType '12345'
:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem( 'tt_content', 'CType', [ 'Test item with numeric type', '12345', 'actions-exclamation-triangle-alt' ] );
2. Create or edit a backend user group ...
TypeError preg_replace(): Argument #3 ($subject) must be of type array|string, int given
Error Source¶
PHP casts keys containing valid decimal ints to INT
.
Thus $itemValue
passed to preg_replace()
on Line 149 of TcaItemsProcessorFunctions.php could be an INT
and must be cast to STRING
.
$fieldDefinition['items'][] = [ '[' . $allowDenyModeLabel . '] ' . $itemLabel, $groupKey . ':' . preg_replace('/[:|,]/', '', $itemValue) . ':' . $allowDenyMode, $icons[$allowDenyMode], ];
Easy Fix¶
- $groupKey . ':' . preg_replace('/[:|,]/', '', $itemValue) . ':' . $allowDenyMode, + $groupKey . ':' . preg_replace('/[:|,]/', '', (string)$itemValue) . ':' . $allowDenyMode,
Updated by Gerrit Code Review over 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/+/73806
Updated by Gerrit Code Review over 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/+/73778
Updated by Georg Ringer over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e983a7b57556297f87ad9026b57598dff5e5e163.