[ic] Parser eats up false values in tag body

Stefan Hornburg (Racke) racke at linuxia.de
Mon Aug 30 10:14:01 UTC 2010


Hello, Interchange enthusiasts!

Today I stumbled on a weird problem, which turned out to be deficiency in the ITL parser.

Inside [perl] I had the following statement:

	$after = $Tag->filter({op => 'strip', body => $CGI->{"after_$sku"}});

To my surprise this yields an empty string if $CGI->{"after_$sku"} is zero.

The following statement works as expected:

	$after = $Tag->filter('strip', $CGI->{"after_$sku"});

This patch fixes the problem:

--- a/lib/Vend/Parse.pm
+++ b/lib/Vend/Parse.pm
@@ -482,7 +482,7 @@ sub resolve_args {
         }
         @list = @{$ref}{@{$Order{$tag}}};
         push @list, $ref if defined $addAttr{$tag};
-       push @list, (shift || $ref->{body} || '') if $hasEndTag{$tag};
+       push @list, (shift || (defined $ref->{body} ? $ref->{body} : '')) if $hasEndTag{$tag};
         return @list;
  }

Regards
         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