Bug #54520
closedjoinTSarrays() is array_replace_recursive
0%
Description
\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::joinTSarrays can be replaced by the PHP native array_replace_recursive().
array_replace_recursive() replaces the values of array1 with the same values from all the following arrays. If a key from the first array exists in the second array, its value will be replaced by the value from the second array. If the key exists in the second array, and not the first, it will be created in the first array. If a key only exists in the first array, it will be left as is. If several arrays are passed for replacement, they will be processed in order, the later array overwriting the previous values.
array_replace_recursive() is recursive : it will recurse into arrays and apply the same process to the inner value.
That is exactly what the joinTSarrays() does.
I think we should replace the calls with straight up array_replace_recursive() and deprecate joinTSarrays()
joinTSarrays() both overwrites the $conf values with anything in the $old_conf and also creates any elements not present in $conf with new values from $old_conf. So they are functionally identical.
Updated by Gerrit Code Review over 10 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/26500
Updated by Gerrit Code Review over 10 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/26500
Updated by Ernesto Baschny over 10 years ago
- Status changed from Under Review to Resolved
- Target version changed from next-patchlevel to 6.2.0
Updated by Riccardo De Contardi almost 7 years ago
- Status changed from Resolved to Closed