Argument 1 passed to Kirby\Cms\StructureObject::setContent() must be of the type array or null, string given, called in C:\xampp\htdocs\ikarov\kirby\src\Toolkit\Properties.php on line 138
In the debugger, I saw this came from a toStructure() call:
This was very tricky to debug because toStructure() is called by a plugin. When you save the default translation, the plugin syncs the structure data with all other translations. Each entry had an options field of type tags which is a comma-separated string. When I changed the blueprint of that field to structure, this error began to appear because the saved value was not a YAML-encoded structure.
To Reproduce
Steps to reproduce the behavior:
Have a site.txt with arbitrary string as content.
Run $site->title()->toStructure()
Expected behavior
Whenever toStructure() is called with invalid data, it should return an empty structure. Then, when the value is saved, whatever invalid value existed before would be replaced with a valid one.
The error I'm getting is:
In the debugger, I saw this came from a
toStructure()
call:This was very tricky to debug because
toStructure()
is called by a plugin. When you save the default translation, the plugin syncs the structure data with all other translations. Each entry had anoptions
field of typetags
which is a comma-separated string. When I changed the blueprint of that field tostructure
, this error began to appear because the saved value was not a YAML-encoded structure.To Reproduce Steps to reproduce the behavior:
$site->title()->toStructure()
Expected behavior Whenever
toStructure()
is called with invalid data, it should return an empty structure. Then, when the value is saved, whatever invalid value existed before would be replaced with a valid one.Kirby Version 3.2.3