[TYPO3-dev] Small problem with t3lib_div::inList(...), returns true when it shouldn't.....
Martin Kutschker
masi-no at spam-typo3.org
Wed Aug 26 15:45:45 CEST 2009
Ries van Twisk schrieb:
> hey All,
>
> today I had to work with some odd data and came to encounter this issue:
>
>
> Here is an example that explains it :
>
> echo t3lib_div::inList(',n,e,', 'n,e')?'In List':'Not In List'; //
> prints In List
>
> Here is the implementation:
>
> return (strpos(','.$list.',', ','.$item.',')!==false ? true : false);
>
> which expands to return (strpos(',,n,e,,', ',n,e,')!==false ? true :
> false);
>
> The function doc states : Check if an item exists in a comma-separated
> list of items.
>
> That means that the function should check in the case above return false
> and not true,
Actually it should throw an exception because of the wrong input
parameter. As the haystack is comma-separated the needle must not
contain a comma.
Masi
More information about the TYPO3-dev
mailing list