You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Symfony YAML handler – 'yaml.handler' => 'symfony' – Kirby will create non-empty values for empty content. Given a files field, removing all previously selected files will be stored as [] in the content file. Using the default YAML handler will result in an empty string.
Result with Symfony YAML handler:
Files: []
Result with default YAML handler:
Files:
This divergent behaviour will cause issues when using isEmpty or methods relying on this method (like isNotEmpty or or) because isEmpty checks on the plain field value. So even if isNotEmpty will return true on an object, as consecutive call to toFile() will still result in an empty object. This is unexpected and does break templating logic.
Expected behavior
Empty values should be identified correctly independent of the chosen YAML handler.
Scope
This will affect any field storing collection-like content.
To reproduce
Create a files field.
Select a file, save.
Unselect that file, save.
Check the stored value in the content file.
Repeat with different YAML formatter.
Your setup
Kirby Version
4.4.0 RC1 but it should be the same issue ever since YAML handlers have been introduced. PHP Version
In case this matters, it happens on PHP 8.2 for us.
The text was updated successfully, but these errors were encountered:
The fallback was never used because or always assumed the header image to be set und toFile then return null. header and cover both being files fields here.
Description
When using the Symfony YAML handler –
'yaml.handler' => 'symfony'
– Kirby will create non-empty values for empty content. Given a files field, removing all previously selected files will be stored as[]
in the content file. Using the default YAML handler will result in an empty string.Result with Symfony YAML handler:
Result with default YAML handler:
Files:
This divergent behaviour will cause issues when using
isEmpty
or methods relying on this method (likeisNotEmpty
oror
) becauseisEmpty
checks on the plain field value. So even ifisNotEmpty
will returntrue
on an object, as consecutive call totoFile()
will still result in an empty object. This is unexpected and does break templating logic.Expected behavior
Empty values should be identified correctly independent of the chosen YAML handler.
Scope
This will affect any field storing collection-like content.
To reproduce
Your setup
Kirby Version
4.4.0 RC1 but it should be the same issue ever since YAML handlers have been introduced.
PHP Version
In case this matters, it happens on PHP 8.2 for us.
The text was updated successfully, but these errors were encountered: