You are here: Foswiki>Tasks Web>Item12929 (02 Jun 2014, MichaelDaum)Edit Attach

Item12929: EasyMacroPlugin incorrectly passes parameters with number 0

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: EasyMacroPlugin
Branches: trunk
Reported By: MichaelTempest
Waiting For:
Last Change By: MichaelDaum
Suppose I register a macro %FOO with EasyMacroPlugin and pass it the number zero:
%FOO{bar="0"}%

then parameter bar becomes an empty string.

I think the problem is here: http://trac.foswiki.org/browser/trunk/EasyMacroPlugin/lib/Foswiki/Plugins/EasyMacroPlugin.pm#L130

Would you like me to check in a fix?

-- MichaelTempest - 31 May 2014

Michael, Somehow this task overlayed WebHome. I reverted that change and created this task for you.

-- GeorgeClark - 31 May 2014

Thanks, George. For reference, I was using Opera Mini.

-- MichaelTempest - 01 Jun 2014

Hot fix:

@@ -127,7 +127,8 @@
             if $key eq $Foswiki::Attrs::ERRORKEY
               || $key eq $Foswiki::Attrs::RAWKEY
               || $key eq $Foswiki::Attrs::DEFAULTKEY;
-          my $val = $$innerParams{$key} || '';
+          my $val = $$innerParams{$key};
+          $val = '' unless defined $val;

-- MichaelDaum - 02 Jun 2014

Thank you, Michael. That is exactly the change I had made locally. And yes, that fix works.

-- MichaelTempest - 02 Jun 2014
 
Topic revision: r6 - 02 Jun 2014, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy