[ 
https://issues.apache.org/jira/browse/SLING-9696?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Radu Cotescu resolved SLING-9696.
---------------------------------
    Fix Version/s: Scripting HTL Java Compiler 1.2.2-1.4.0
                   Scripting HTL Testing 1.0.24-1.4.0
                   Scripting HTL Compiler 1.2.8-1.4.0
       Resolution: Fixed

Fixed in:
* [commit 
4307b1e|https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/commit/4307b1e]
* [commit 
76bf4c8|https://github.com/apache/sling-org-apache-sling-scripting-sightly-compiler/commit/76bf4c8]
* [commit 
bfb098b|https://github.com/apache/sling-org-apache-sling-scripting-sightly/commit/bfb098b]
* [commit 
2cdbfef|https://github.com/apache/sling-org-apache-sling-scripting-sightly-testing/commit/2cdbfef]

Requires SLING-9706.

> HTL does not correctly cast the "false" string to Boolean
> ---------------------------------------------------------
>
>                 Key: SLING-9696
>                 URL: https://issues.apache.org/jira/browse/SLING-9696
>             Project: Sling
>          Issue Type: Bug
>          Components: Scripting
>    Affects Versions: Scripting Sightly Engine 1.0.0, Scripting HTL Engine 
> 1.0.20, Scripting HTL Engine 1.1.0-1.4.0, Scripting HTL Engine 1.2.0-1.4.0, 
> Scripting HTL Engine 1.3.0-1.4.0, Scripting HTL Engine 1.4.0-1.4.0
>            Reporter: Radu Cotescu
>            Assignee: Radu Cotescu
>            Priority: Major
>             Fix For: Scripting HTL Compiler 1.2.8-1.4.0, Scripting HTL 
> Testing 1.0.24-1.4.0, Scripting HTL Runtime 1.2.4-1.4.0, Scripting HTL Engine 
> 1.4.4-1.4.0, Scripting HTL Java Compiler 1.2.2-1.4.0
>
>
> The HTL engine implementation from Apache Sling seems to have never correctly 
> casted the "false" string to boolean. The HTL specification [0] mentions the 
> following:
> {noformat}
> These expressions evaluate to false:
> * false
> * 0 (zero)
> * '' or "" (empty string)
> * [] (empty iterable)
> These evaluate to true:
> * "false" (non-empty string)
> * [0] (non-empty iterable)
> {noformat}
> However, all implementations have returned the Boolean {{false}} for any 
> casing of the string "false".
> A change like this has the potential to break the functionality of existing 
> HTL code, relying on the fact that the string "false" (irrespective of its 
> casing) returns the Boolean {{false}}, however the implementation should obey 
> the specification. Therefore I think the fix should be behind a configuration 
> flag, which by default allows the engine to continue working with the wrong 
> behaviour. Deployers can then decide via configuration if they would like to 
> switch the engine to the correct behaviour.
>  
> [0] - 
> [https://github.com/adobe/htl-spec/blob/1.4/SPECIFICATION.md#115-casting]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to