Project

General

Profile

Actions

Bug #65123

closed

GeneralUtility::rmFromList() regression bug

Added by Gregor Favre almost 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Backend API
Target version:
Start date:
2015-02-17
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
easy
Is Regression:
Yes
Sprint Focus:

Description

Using TYPO3 6.2.9.

GeneralUtility::rmFromList() suffers from a regression bug. It is not handling the removal of list items properly, if the list contains the item several times. The behaviour of str_replace() is documented in the PHP documentation (see http://php.net/manual/en/function.str-replace.php section "Caution: Replacement order gotcha".

The old implementation not using str_replace() but looping through the elements was working as expected.

Reproducible code:
$param1 = "A";
$param2 = "A,A,A,A,A,A,A,A";
$result = GeneralUtility::rmFromList($param1, $param2);

Expected result:
$result should be empty

Returned result:
$result is "A,A,A,A"


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #53677: GeneralUtility::rmFromList : allow to call GeneralUtility::trimExplodeClosed

Actions
Actions

Also available in: Atom PDF