[TYPO3-dev] Small problem with t3lib_div::inList(...), returns true when it shouldn't.....

Ries van Twisk typo3 at rvt.dds.nl
Tue Aug 25 07:25:36 CEST 2009


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,

So that would means that the function should check if the item 'n,e'  
matched item 'n' or the item 'e'.

Agreed that this is quite corner case and that there are very small  
changes are they people encounter this,
but with data parsing this can happen....

Is this worth a bug report?

Ries





			regards, Ries van Twisk

-------------------------------------------------------------------------------------------------
tags: Freelance TYPO3 Glassfish JasperReports JasperETL Flex Blaze-DS  
WebORB PostgreSQL DB-Architect
email: ries at vantwisk.nl        web:   http://www.rvantwisk.nl/     
skype: callto://r.vantwisk
Phone: +1-810-476-4196    Cell: +593 9901 7694                   SIP:  
+1-747-690-5133











More information about the TYPO3-dev mailing list