[TYPO3-core] GeneralUtility::inList() and spaces

Markus Klein klein.t3 at mfc-linz.at
Wed Jul 10 13:23:07 CEST 2013


I'm ok with your suggestion.

Kind regards
Markus

------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member

> -----Original Message-----
> From: typo3-team-core-bounces at lists.typo3.org [mailto:typo3-team-core-
> bounces at lists.typo3.org] On Behalf Of bernd wilke
> Sent: Wednesday, July 10, 2013 12:40 PM
> To: typo3-team-core at lists.typo3.org
> Subject: Re: [TYPO3-core] GeneralUtility::inList() and spaces
> 
> Am 10.07.13 12:15, schrieb François Suter:
> > Hi Markus,
> >
> >> I suggest to use "the middle way" and just do a trim() on the values,
> >> which still does the trick without RegExp.
> >
> > That's what I thought too, but inList() doesn't explode the string. It
> > just does:
> >
> > return strpos(',' . $list . ',', ',' . $item . ',') !== FALSE ? TRUE :
> > FALSE;
> >
> > So again, exploding the string and trimming its components is much
> > more work than using strpos(). I don't know what the performance
> > impact could be, given that it's such a widespread method.
> 
> as exploding and imploding would be too expensive a replacement of
> (white)spaces should be possible
> 
> return strpos(',' . str_replace(' ', '', $list) . ',', ',' . $item .
> ',') !== FALSE ? TRUE : FALSE;
> 
> otherwise you have to ensure that all lists written are 'de-spaced'.
> 
> bernd
> --
> http://www.pi-phi.de/cheatsheet.html
> _______________________________________________
> Before posting to this list, please have a look to the posting rules on the
> following websites:
> 
> http://typo3.org/teams/core/core-mailinglist-rules/
> http://typo3.org/development/bug-fixing/diff-and-patch/
> _______________________________________________
> TYPO3-team-core mailing list
> TYPO3-team-core at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-team-core



More information about the TYPO3-team-core mailing list