neos / neos-development-collection

The unified repository containing the Neos core packages, used for Neos development.
https://www.neos.io/
GNU General Public License v3.0
260 stars 220 forks source link

Regression 8.0 Fusion `DataStructure` omits `null` value in rare case #4499

Open mhsdesign opened 10 months ago

mhsdesign commented 10 months ago

In Neos 7.3 this rendered to

root = Neos.Fusion:Component {
  somePathWithPlainNull = null
  renderer = Neos.Fusion:DataStructure {
    key = ${props.somePathWithPlainNull}
  }
}
{"key": null}

but similar to https://github.com/neos/neos-development-collection/issues/3859 probably since 8.0 change https://github.com/neos/neos-development-collection/pull/3645 in the result the key "key" is completely omitted:

{}

Similar to https://github.com/neos/neos-development-collection/pull/3677 this is a problem with the global use of the "$lastEvaluationStatus" flag.

I traced the problem down to:

Before the eel expression is evaluated evaluateExpressionOrValueInternal the evaluation status is set to "EXECUTED", but inside the eel expression via "props.somePathWithPlainNull" we trigger a side effect because this lazy prop is evaluated and because fusion finds nothing useful in "somePathWithPlainNull" it sets the status to "SKIPPED".

Because of that we skip the value in the data-structure: https://github.com/neos/neos-development-collection/blob/132321889aeeca17caa2a6f3117e1fbc8e8a5a9e/Neos.Fusion/Classes/FusionObjects/AbstractArrayFusionObject.php#L133-L135

related problem: that fusion has no good concept of null. The assigned values = null and = ${null} are treated internally completely different.

kitsunet commented 10 months ago

I thought that was intentional to basically allow unsetting keys, eg. for css class merging?

mhsdesign commented 3 weeks ago

has to be retested after https://github.com/neos/neos-development-collection/pull/5033