Actions
Bug #65123
closedGeneralUtility::rmFromList() regression bug
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"
Actions