Lafougere / node-cfml

a simple cfml view engine for node.js/express
GNU General Public License v2.0
9 stars 3 forks source link

[Bug] Boolean types are not evaulated in render #5

Open AndrewKralovec opened 5 years ago

AndrewKralovec commented 5 years ago

In the render function, we check to see if a property is on an object to find out if we need to evaul it into tmp. This will fail if the value of that property is evaluated to false. Ex:

// if (false)
if (vars[instr.value]) out += vars[instr.value] // if go through undefined logic

Instead we should be checking if its undefined. if (vars[instr.value] !== undefined) out += vars[instr.value]

<body>
      <cfset temp = false >
      <cfif temp>
        <h2> Hello </h2>
      <cfelse>
        <h2> GoodBye </h2>
      </cfif>

        <cfoutput>
          #title# <br>
          #message# <br>
          #temp# <!--- Will Error out --->
        </cfoutput>
</body>