Bug #54520

joinTSarrays() is array_replace_recursive

Added by Michiel Roos almost 6 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Performance
Target version:
Start date:
2013-12-19
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

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.

Associated revisions

Revision e7128300 (diff)
Added by Michiel Roos almost 6 years ago

[TASK] joinTSarrays() is replaced by array_replace_recursive()

\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::joinTSarrays is
replaced by the PHP native array_replace_recursive() (added in PHP 5.3.0)
which does exactly the same and is twice as fast.

Usage of $cObj->joinTSarrays() is deprecated.

Change-Id: I748270a192bccc89927e0d6b82a1f405959b2209
Resolves: #54520
Releases: 6.2
Reviewed-on: https://review.typo3.org/26500
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny

History

#1 Updated by Gerrit Code Review almost 6 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

#2 Updated by Gerrit Code Review almost 6 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

#3 Updated by Ernesto Baschny almost 6 years ago

  • Status changed from Under Review to Resolved
  • Target version changed from next-patchlevel to 6.2.0

#4 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF