You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Josh Wang (JIRA)" <ji...@apache.org> on 2017/09/18 07:17:00 UTC

[jira] [Created] (FREEMARKER-72) Import 2 different files which include 1 same file makes vars the same

Josh Wang created FREEMARKER-72:
-----------------------------------

             Summary: Import 2 different files which include 1 same file makes vars the same
                 Key: FREEMARKER-72
                 URL: https://issues.apache.org/jira/browse/FREEMARKER-72
             Project: Apache Freemarker
          Issue Type: Bug
          Components: engine
    Affects Versions: 2.3.26-incubating
            Reporter: Josh Wang


Four Files:

*p1.ftl*

{code:java}
<#assign id="p1">
<#include "macro.ftl">
{code}

*p2.ftl*

{code:java}
<#assign id="p2">
<#include "macro.ftl">
{code}

*macro.ftl*

{code:java}
<#macro showId>${.vars.id}</#macro>
{code}

*index.ftl*

{code:java}
<#import "p1.ftl" as p1><@p1.showId /><#-- @showId == p1 -->
<#import "p2.ftl" as p2><@p2.showId /><#-- @showId == p2 -->

<@p1.showId /><#-- Why @showId == p2 ??? -->
{code}

First call <@p1.showId /> show the right result. But after call <@p2.showId />, if you call <@p1.showId /> again, the result is wrong.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)