Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5 beta2, 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: PC

      Description

      #set statements are not being parsed in #macros in VM_global_library.
      Worked in 1.3.1, doesn't in 1.4.

      I'm going to attach the #macro and the diff'd 1.3.1 vs 1.4 output.

      -Mike

        Activity

        Hide
        Mike Kienenberger added a comment -

        Created an attachment (id=11249)
        Diff between 1.3.1 and 1.4 output

        Show
        Mike Kienenberger added a comment - Created an attachment (id=11249) Diff between 1.3.1 and 1.4 output
        Hide
        Mike Kienenberger added a comment -

        Created an attachment (id=11250)
        example #macro containing non-parsing #set

        Show
        Mike Kienenberger added a comment - Created an attachment (id=11250) example #macro containing non-parsing #set
        Hide
        Will Glass-Husain added a comment -

        Thanks for reporting this. Assigning to 1.5 release.

        Show
        Will Glass-Husain added a comment - Thanks for reporting this. Assigning to 1.5 release.
        Hide
        Henning Schmiedehausen added a comment -

        I built a small test bed using

        — cut —
        #macro(issue262 $baz)
        #set ($bar = "$baz")
        #set ($foo = "inside macro!")
        #end
        — cut —

        in the global macros file and

        — cut —
        <pre>
        $foo

        #issue262("from macro")
        $foo
        $bar

        #set ($foo = "foo")
        #set ($bar = "empty")
        $foo
        $bar

        #issue262("from macro2")
        $foo
        $bar

        </pre>
        — cut —

        as template. This rendered as:

        — cut —
        $foo

        inside macro!
        from macro

        foo
        empty

        inside macro!
        from macro2
        — cut —

        So

        1) $foo was unset (the macro definition in the global macros file did not change this value in any way)

        2) $foo and $bar were set (changed) inside the macro. This is visible on the outside as $foo and $bar
        changed values.

        3) $foo and $bar could be changed on the template to other values.

        4) running the macro again (with another value for the parameter resulted in another value for $bar. So
        re-evaluating the macro does change the value of the reference.

        Works as expected, if you ask me. Any comments / could you try your case with Velocity 1.5? I tend to close the case as "cannot reproduce".

        Show
        Henning Schmiedehausen added a comment - I built a small test bed using — cut — #macro(issue262 $baz) #set ($bar = "$baz") #set ($foo = "inside macro!") #end — cut — in the global macros file and — cut — <pre> $foo #issue262("from macro") $foo $bar #set ($foo = "foo") #set ($bar = "empty") $foo $bar #issue262("from macro2") $foo $bar </pre> — cut — as template. This rendered as: — cut — $foo inside macro! from macro foo empty inside macro! from macro2 — cut — So 1) $foo was unset (the macro definition in the global macros file did not change this value in any way) 2) $foo and $bar were set (changed) inside the macro. This is visible on the outside as $foo and $bar changed values. 3) $foo and $bar could be changed on the template to other values. 4) running the macro again (with another value for the parameter resulted in another value for $bar. So re-evaluating the macro does change the value of the reference. Works as expected, if you ask me. Any comments / could you try your case with Velocity 1.5? I tend to close the case as "cannot reproduce".
        Hide
        Will Glass-Husain added a comment -

        I took a quick look at Mike's example. Seems hard to reproduce without full code. There's a couple of different settings for macros that might affect this.

        Mike – I know this is a couple of years old. Still, would you be able to run this example against the Velocity 1.5 beta so we can see if it has been previously fixed?

        Show
        Will Glass-Husain added a comment - I took a quick look at Mike's example. Seems hard to reproduce without full code. There's a couple of different settings for macros that might affect this. Mike – I know this is a couple of years old. Still, would you be able to run this example against the Velocity 1.5 beta so we can see if it has been previously fixed?
        Hide
        Henning Schmiedehausen added a comment -

        I think this bug report might be related to 'velocimacro.context.localscope = true'. If you set this, you should get the behaviour described by Mike. (My example uses false)

        Show
        Henning Schmiedehausen added a comment - I think this bug report might be related to 'velocimacro.context.localscope = true'. If you set this, you should get the behaviour described by Mike. (My example uses false)
        Hide
        Henning Schmiedehausen added a comment -

        Built a test bed for this case and it works for me as the 1.3.1 case. Seems that we resolved this bug along the way. Please reopen otherwise.

        Show
        Henning Schmiedehausen added a comment - Built a test bed for this case and it works for me as the 1.3.1 case. Seems that we resolved this bug along the way. Please reopen otherwise.
        Hide
        Henning Schmiedehausen added a comment -

        Close all resolved issued for 1.5 beta 2.

        Show
        Henning Schmiedehausen added a comment - Close all resolved issued for 1.5 beta 2.

          People

          • Assignee:
            Henning Schmiedehausen
            Reporter:
            Mike Kienenberger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development