[TYPO3-core] RFC #9779: t3lib_div::trimExplode limit parameter leads to wrong result with non-empty requirement

Ingo Renner ingo at typo3.org
Tue Mar 10 14:31:43 CET 2009


Benjamin Mack wrote:

Hi Benni

> $str = 'my,d2,8m,emt,masd2';
> $arr = explode(',', $str, 2);
>
> results in
>
> array(
> 0 => my
> 1 => d2,8m,emt,masd2
> )

right, that's what explode does, but to me is quite ilogical and I 
couldn't think of a situation in real life where this could be useful.

> However, our solution results in
>
> $arr = t3lib_div::trimExplode(',', $str, false, 2);
>
> array(
> 0 => my
> 1 => d2
> )

right, this is what the description of the method says it does.

> I don't think that's what people expect from a trimExplode, right?

just point them to the manual ;)

> Also,
> then we have the third "remove empty vars" which makes it even more
> difficult.

what about it?

best
Ingo

-- 
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2



More information about the TYPO3-team-core mailing list