Thanks to visit codestin.com
Credit goes to github.com

Skip to content

multi condition in if statement does not work #3624

@lostika86

Description

@lostika86

Bug Description

{{ if view:image|length > 5 && view:image|length < 9 }} is true when array variable has 10 items

How to Reproduce

---
image:
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
    - https://placeimg.com/412/280/people/sepia
---
{{ if view:image|length > 5 && view:image|length < 9 }} // true --> should be false
{{ if view:image|length > 5 && 8 < 9 }} // true
{{ if 8 < 9 && view:image|length > 5 }} // true

Extra Detail

update: {{ if view:image|count > 5 && view:image|length < 9 }} // false

Environment

Statamic 3.1.11 Pro
Laravel 8.40.0
PHP 7.3.12
doublethreedigital/duplicator 1.3.1

Install method (choose one):

  • Fresh install from statamic/statamic

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions