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

Radu Cotescu updated SLING-9696:
--------------------------------
    Description: 
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]

  was:
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}

[0] - https://github.com/adobe/htl-spec/blob/1.4/SPECIFICATION.md#115-casting


> 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 Engine 1.4.4-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