-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A numerical value of 0 is incorrectly treated as falsy #74
Comments
The issue is https://github.com/jg-rp/liquid/blob/main/liquid/expression.py#L914 obj in (False, None) evaluates to true because |
I wonder if adding a type check would address any edge cases.
|
There are a couple of cases that that does not cover. Undefined variables and drops that define This bug also extends to comparison operators and the {% if 0.0 == false %}0.0 == false{% endif %}
{{ 0.0 | default: "hello" }} Expected output
Actual output
|
Fixed in version 1.4.5, now released. |
Per https://shopify.github.io/liquid/basics/truthy-and-falsy/ "All values in Liquid are truthy except nil and false."
However, the integer
0
and float0.0
are being treated as falsy.Trying the following code input:
Output:
If this is intended, I don't see this boolean behavior defined in known issues in https://jg-rp.github.io/liquid/known_issues
The text was updated successfully, but these errors were encountered: