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

Benjamin Mack benni at typo3.org
Thu Mar 5 10:07:54 CET 2009


Hey Ingo,

just found out about the wrong trimExplode implementation of explode. An 
"explode" call with a $limit parameter does this:

	$str = 'my,d2,8m,emt,masd2';
	$arr = explode(',', $str, 2);

results in

	array(
		0 => my
		1 => d2,8m,emt,masd2
	)

However, our solution results in

	$arr = t3lib_div::trimExplode(',', $str, false, 2);

	array(
		0 => my
		1 => d2
	)

I don't think that's what people expect from a trimExplode, right? Also, 
then we have the third "remove empty vars" which makes it even more 
difficult.

All the best,
Benni.


More information about the TYPO3-team-core mailing list