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

Oliver Hader oliver at typo3.org
Tue Oct 20 12:50:42 CEST 2009


FYI: Committed the attached patch as follow-up to SVN Trunk (rev. 6180)

Problem:
Using the $limit argument with trimExplode() did not behave the same as
in the regular explode.

Solution:
trimExplode() explodes as string and removes the whitespaces.
Furthermorge, if defined, empty items get removed from the resultset.
The $limit argument can then be used to reduce the resultset:
* $limit > 0: Will only return as many results as defined, a rest is
delivered in the last item of the results, e.g. ('a', 'b', 'c,d,e')
* $limit < 0: Will remove the last elements from the result set without
using a rest

Thus, the behaviour of t3lib_div::trimExplode() comes closer again to
the behaviour of explode().

Notes:
The test cases have been modified and extended to check these
behaviours. The only usage in the Core was in t3lib_extMgm:544, where
the limit parameter was used to split the definitions of a field for
TCEforms - it still works as expected.

olly


Ingo Renner schrieb:
> 
> committed to trunk
> 
> 
> Ingo
-- 
Oliver Hader
TYPO3 Release Manager 4.3


More information about the TYPO3-team-core mailing list