sebastienros/fluid

Nil and blank operator confusion

Opened this issue · 0 comments

Hello,

Take this example :

{% if Absence.AnimalOnSite != nil %}
<mj-group>
    <mj-column width="70%" padding="0 15px">
        <mj-text padding="0">
            {% if Absence.AnimalOnSite %}
            Animal présent sur site
            {% else %}
            Animal temporairement absent
            {% endif %}
        </mj-text>
    </mj-column>
</mj-group>
{% endif %}

If the 'AnimalOnSite' boolean of my 'Absence' object is not set, I would expect to have a value of nil.
However, it doesn't work, I have nothing... but if I use the blank operator instead of nil it works.

Is this a bug or a lack of interpretation?

Note:

  • I use UnsafeMemberAccessStrategy
  • A Dictionary<string, object> as parameter

Full code : https://dotnetfiddle.net/lHt8L6

@+