[ic] Bug in "EITHER" coretag

Stefan Hornburg racke at linuxia.de
Fri Mar 9 14:26:16 EST 2007


Carl Bailey wrote:
> We found what we believe to be a fault in the [either] coretag.
> 
> We used the following code on a page:
>    [either][cgi idxnum][or]0[/either]
> When the cgi value is absent this tag returns nothing -- a null string, 
> rather than the desired '0' character.
> 
> The reason for this is that the either coretag splits its body on "[or]" 
> and interpolates each chunk in turn, removes leading and trailing spaces 
> from the result and returns the first "true" result.  However in 
> determining what to return, it uses the statement "return $result if 
> $result;"  Obviously when $result = '0', this fails to return anything.  

Therefore the last statement in the tag should be:

return $result if $result =~ /\S/;

Bye
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list