Bug #16754
closedsplit returnKey fails to recognize the max property
0%
Description
stdWrap "split" function has a "max" property, that don't work when "returnKey" is used.
If, using typoscript, we want to get the last part of a split, for example using max = 1, thus getting just two parts, we don't get the last part of the split. Instead, the content being split will be exploded without limit, and we will get just the second item of the whole array.
This is implemented at class.tslib_content.php line 4021:
$valArr=explode($conf['token'],$value);
If this behavior was not done on purpose, maybe the script should find out if returnKey and max are being used together and, if so, explode the $value, using the third argument of the explode function, so it can return the whole last part of the split.
(issue imported from #M4594)
Updated by Carlos A almost 18 years ago
I added a new line to the script, between lines 4024 and 4025, and now they are like this:
$key = intval($this->stdWrap($conf['returnKey'],$conf['
if($conf['max']) $valArr=explode($conf['token'],$value,$conf['max']+1); // NEW LINE
$content = isset($valArr[$key]) ? $valArr[$key] : '';
This worked so far.
Updated by Alexander Opitz over 11 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
0) - TYPO3 Version changed from 4.1beta1 to 4.1
- PHP Version deleted (
4)
The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?
Updated by Alexander Opitz about 11 years ago
- Status changed from Needs Feedback to Closed
No feedback for over 90 days.