Bug #81779
closedSuggestWizardDefaultReceiver overrides pids when pidList is used
100%
Description
The suggest wizard can be configurated to use a list of pids (pidList) to search from. But the array of allowed pids is constructed the wrong way.
This happens in the constructor method in line 116 in combination with method getAllSubpagesOfPage:
111 if (isset($config['pidList'])) { 112 $allowedPages = ($pageIds = GeneralUtility::trimExplode(',', $config['pidList'])); 113 $depth = (int)$config['pidDepth']; 114 foreach ($pageIds as $pageId) { 115 if ($pageId > 0) { 116 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($allowedPages, $this->getAllSubpagesOfPage($pageId, $depth)); 117 } 118 } 119 $this->allowedPages = array_unique($allowedPages); 120 }
Example:
pidList = 5,2,3
pidDepth = 0
results in $this->allowedPages: 3,2,3
Reason is that the array of pids has normal integer keys that get overriden when merged. Perhaps the pid array should take the pids as keys.
Updated by Thorsten Reiter almost 7 years ago
could be fixed as following:
if (isset($config['pidList'])) { - $allowedPages = ($pageIds = GeneralUtility::trimExplode(',', $config['pidList'])); + $pageIds = GeneralUtility::trimExplode(',', $config['pidList']); + $allowedPages = array_flip($pageIds); $depth = (int)$config['pidDepth']; foreach ($pageIds as $pageId) { if ($pageId > 0) { - \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($allowedPages, $this->getAllSubpagesOfPage($pageId, $depth)); + \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($allowedPages, array_flip($this->getAllSubpagesOfPage($pageId, $depth))); } } - $this->allowedPages = array_unique($allowedPages); + $this->allowedPages = array_keys($allowedPages); }
Updated by Riccardo De Contardi almost 7 years ago
Hi and thank you for your findings. Could you please push a patch to Gerrit (https://review.typo3.org/) ?
See istructions here: https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/ feel free to ask for support on Slack if needed, and thank you again!
Updated by Susanne Moog almost 7 years ago
- Category set to FormEngine aka TCEforms
Updated by Georg Ringer over 4 years ago
can be easily tested with a modified TCA of pages and a shortcut page
using
'shortcut' => [ 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.shortcut_page', 'config' => [ 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'size' => 1, 'maxitems' => 1, 'minitems' => 0, 'suggestOptions' => [ 'default' => [ 'pidList' => '20,13', 'depth' => 2 ] ], 'default' => 0, 'behaviour' => [ 'allowLanguageSynchronization' => true ] ] ],
Updated by Gerrit Code Review over 4 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63632
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63632
Updated by Gerrit Code Review over 4 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63632
Updated by Gerrit Code Review over 4 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63632
Updated by Gerrit Code Review over 4 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63632
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 9.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/+/63653
Updated by Georg Ringer over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6f2e9567b48ba1d45cf9c14cde611c7aee1ac5c9.